MySQL upgrade SELECT problems

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
rxsid
Forum Commoner
Posts: 82
Joined: Thu Aug 29, 2002 12:04 am

MySQL upgrade SELECT problems

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

might be that 'password' is a function name.. By the way, mysql has a SHA1 function.. ;)
rxsid
Forum Commoner
Posts: 82
Joined: Thu Aug 29, 2002 12:04 am

Post 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.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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? .. :?
rxsid
Forum Commoner
Posts: 82
Joined: Thu Aug 29, 2002 12:04 am

Post by rxsid »

it works no problem from phpMyAdmin 2.6.1. same exact query returns the appropriate result.

any other ideas?
Post Reply