Page 1 of 1

MySQL upgrade SELECT problems

Posted: Thu Feb 10, 2005 7:42 pm
by rxsid
Hi all,

previous environment:
mysql 4.0.18 (max debug)
php 4.3.1
windowsNT server
webserver - IIS
new environment:
mysql 4.1.9-nt-log
php 4.3.1
windows2003 server
webserver - Apache 2.0.52
I have a varchar(40) password field that I used to store sha() encrypted passwords in. In the previous environment, I could use :

Code: Select all

$password = sha1($password);

$checkUser = mysql_query ("SELECT * FROM users WHERE User = '$userid' AND PASSWORD = '$password'",$web_connection) or exit (mysql_error());
and it worked just fine.
In the new environment...it doesn't work & no mysql_error is output.

The only signigicant difference I can see is with the newer db version and using Collation. I changed my table from the default latin1_swedish_ci to default-character-set=utf8 in the my.ini file for future table addition. I also change the current user table (to which my query goes against) to utf8_bin (I've tried a few others as well).
Do you think that the Collation column is my problem? The php code didn't change a bit.

Thanks

Posted: Thu Feb 10, 2005 8:11 pm
by feyd
might be that 'password' is a function name.. By the way, mysql has a SHA1 function.. ;)

Posted: Thu Feb 10, 2005 8:14 pm
by rxsid
thanks for the reply feyd....

what do you mean by it may be 'password' is a function?

also...the reason i use php's sha1() fucntion is that i could never get the mysql version to work. i searched, read, plodded through other sources and just couldn't get it to work so i have used php's sha1() with success.

Posted: Thu Feb 10, 2005 8:20 pm
by feyd
I was saying that maybe you have a conflict with 'password' because it is an internal function name. Have you tried this query in phpMyAdmin? What about backticking the field names?

Odd that you weren't able to get SHA1() to work, did you try SHA() as well? .. :?

Posted: Fri Feb 11, 2005 12:54 pm
by rxsid
it works no problem from phpMyAdmin 2.6.1. same exact query returns the appropriate result.

any other ideas?