Jump to content
Sign in to follow this  
Tomy46

SQL Problem

Recommended Posts

Tomy46

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

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 by Zedna

Share this post


Link to post
Share on other sites
Tomy46

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
smartee

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

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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.