Jump to content

need help with mysql udf's


Recommended Posts

i found cdkid's mysql udfs and i found them very usefull but im haveing trouble with _query function

here is a simple version of my script

CODE
#include <GUIConstants.au3>
#include <mysql.au3>
#include <GuiList.au3>

$Username = ""
$Password = ""
$DB = ""
$server = ""

$database = _MySQLConnect($Username, $Password, $DB, $server)
$Form1 = GUICreate("AForm1", 321, 87, 193, 115)
$List1 = GUICtrlCreateList("", 8, 8, 113, 71)
$Input1 = GUICtrlCreateInput("", 128, 8, 129, 21)
$Input2 = GUICtrlCreateInput("", 128, 32, 129, 21)
$Button1 = GUICtrlCreateButton("Look up user", 128, 56, 131, 21, 0)
$Label1 = GUICtrlCreateLabel("Username", 264, 8, 52, 17)
$Label2 = GUICtrlCreateLabel("Password", 264, 32, 50, 17)
_loadusers()
GUISetState()


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            _lookupuser()
    EndSwitch
WEnd

Func _loadusers()
    $users = _GetColVals($database , "Account", "Username")
    for $x = 1 to $users[0]
        GUICtrlSetData($List1, $users[$x])
    Next
EndFunc

Func _lookupuser()
    $user = _GUICtrlListGetSelItemsText($List1)
    $query = "SELECT password FROM account WHERE username='"&$user[1]&"';"
    $userdata = _query($database,$query)
    if not $userdata = 0 then 
        GUICtrlSetData($Input1,$user[1])
        GUICtrlSetData($input2,$userdata)
    Endif
Endfunc

the problem is that the _query always returs 0 even if i change $user[1] to someing i know i have in the database, the wierd thing is that

_GetColVals($database , "Account", "Username") works so the script is able to read from the database.

Edited by Alek

[font="Impact"]Never fear, I is here.[/font]

Link to comment
Share on other sites

You'll have a better luck for support if you address your question to MySQL's specific thread. There are many people there that already uses it and might help you better than here.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...