Tomy46 0 Posted August 13, 2011 Hello everyone I had some problems in recovering some MySQL data: In my case, I want to recover a password in the form of hash from a MySQL database from a user name ... Here is a piece of my code: $SQL_connex = _MySQLConnect($SQL_conf[3][1],$SQL_conf[4][1],$SQL_conf[2][1],$SQL_conf[1][1]) $connex_SHA = _SHA1(GUICtrlRead($connex_pass)) $SQL_Code = "SELECT `user_pass` FROM `user` WHERE `user_login` LIKE "'& GUICtrlRead($connex_user) &'";" $code = _Query($SQL_connex,$SQL_Code) IniWrite("contacts.ini", "TEST", "USER", $code) In short, the only thing is the file register is : "" ... When I execute the query directly on the server, it returns me directly the good result ... in short it's a bug in my code ... Can you help me? Thank you in advance! Tom. P.S : Sorry for my English, I'm french ^^! ======> Tomy ... just for fun <====== Share this post Link to post Share on other sites
Zedna 280 Posted August 13, 2011 (edited) 1) use = instead of LIKE in this case 2) mismash in quotes/double quotes original $SQL_Code = "SELECT `user_pass` FROM `user` WHERE `user_login` LIKE "'& GUICtrlRead($connex_user) &'";" try this $SQL_Code = "SELECT `user_pass` FROM `user` WHERE `user_login` LIKE '" & GUICtrlRead($connex_user) & "';" or this $SQL_Code = "SELECT `user_pass` FROM `user` WHERE `user_login` = '" & GUICtrlRead($connex_user) & "';" Edited August 13, 2011 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Share this post Link to post Share on other sites
Tomy46 0 Posted August 13, 2011 My and your SQL syntax, work in the SQL server but not in my AutoIt script ... Other idea ? ======> Tomy ... just for fun <====== Share this post Link to post Share on other sites
Zedna 280 Posted August 13, 2011 Add error checking after each call of MySql functions. It may be problem with connection establishing. Resources UDF ResourcesEx UDF AutoIt Forum Search Share this post Link to post Share on other sites
smartee 14 Posted August 13, 2011 Umm, make sure you are passing the correct parameters to the _MySQLConnect function, after that line add some error checking, see what @error, $SQL_connex, and _MySQL_Error($SQL_connex) contains. Share this post Link to post Share on other sites