RE: [PHP]MySQL error, what's wrong here..

From: Date: Mon, 23 Jul 2001 23:25:58 +0000
Subject: RE: [PHP]MySQL error, what's wrong here..
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-59276@lists.php.net to get a copy of this message
Try: $query = "SELECT songname FROM mp3 WHERE sgid = '" .$id."'"; an SQL query requires you to quote strings. james -----Original Message----- From: Chris Cocuzzo [mailto:cuzo@mediaone.net] Sent: Monday, July 23, 2001 6:57 PM To: php-general@lists.php.net Subject: [PHP]MySQL error, what's wrong here.. <?php $id = rand(1,2); $query = "SELECT songname FROM mp3 WHERE sgid = " .$id; $result = mysql_query($query,$connection); $mp3d = mysql_fetch_array($result); ?> the server is telling me line 43(which starts with $mp3d) is not a valid mysql result resource. what am i doing wrong?? chris -- 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 (#59276) next »