RE: [PHP] Newbie question with Query

From: Date: Tue, 02 Jan 2001 20:44:32 +0000
Subject: RE: [PHP] Newbie question with Query
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-32338@lists.php.net to get a copy of this message
In SQL, you want to only use one = sign to do the comparisons. $query = mysql_query("SELECT * FROM clients WHERE CUserName='$CUserName' AND CPassword='$CPassword'"); HTH Sam Masiello Systems Analyst Chek.Com (716) 853-1362 x289 smasiello@chekinc.com -----Original Message----- From: Marc Uen [mailto:myuen@ucalgary.ca] Sent: Sunday, December 31, 2000 6:14 PM To: php-general@lists.php.net Subject: [PHP] Newbie question with Query I'm having trouble with user validation. I have a query as follows: $query = mysql_query("SELECT * FROM clients WHERE CUserName=='$CUserName' AND CPassword=='$CPassword'"); if(!query) die ("Invalid username/password combo.") else print "Thank you for loggin in"; The problem is, it rejects a valid username/combo everytime. I am certain that there is a connection with MySQL and when I tried to do a print "$query" to see my result. It brings back nothing. In the SELECT statement, I tried to use only single "=" but it always logs the user in because i'm assigning the variables as equal AND the print "$query" displays resource id#2! Can someone help me out here? Thanks, Marc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#32338) next »