RE: [PHP] MySQL error

From: Date: Tue, 10 Oct 2000 01:21:07 +0000
Subject: RE: [PHP] MySQL error
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-19277@lists.php.net to get a copy of this message
Your SQL statement isn't right. It should read something like: $query = "SELECT * FROM games WHERE genre = ".$gameone_genre." AND number = ".$gameone_number; I don't know if $gameone_genre is a string. If the variables are strings you need to add single quotes: $query = "SELECT * FROM games WHERE genre = '".$gameone_genre."' AND number = '".$gameone_number."'"; Then you say something like: $info = mysql_query($query, $db); // Check to see that you have a valid result returned if ($info) { // valid result, fetch a row from DB $row = mysql_fetch_row($info); } else { // not a valid result - print the error printf(mysql_error()); }

« previous php.general (#19277) next »