RE: [PHP] Help needed about queries with MySQL, thanks.

From: Date: Sun, 18 Aug 2002 12:10:43 +0000
Subject: RE: [PHP] Help needed about queries with MySQL, thanks.
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-113134@lists.php.net to get a copy of this message
> I have a MySQL database (called "sessions") with a auto-increment > INT field called "sessionID". I try to check if there is already > a record in this database with a given sessionID, which is called > $sessionID in PHP. I use this query, which must be wrong (but I > cannot find out why !!!) : > > SELECT * FROM sessions WHERE sessionID = $sessionID Although this may or may not help depending on your code (please post it if you still haven't found a solution...it's the best way for us to help. Try SELECT * FROM sessions WHERE sessionID = '$sessionID' Although if $sessionID contains an integer (which I assume is would) the quotes aren't needed, you never know. Some OSes are quirky. Also you may want to add an echo mysql_error(); line after your initial mysql_query to see if perhaps there's a problem with PHP communicating with MySQL. Sincerely, Craig Vincent

« previous php.general (#113134) next »