Re: Could some one check my code

From: Date: Wed, 26 Nov 2003 12:04:14 +0000
Subject: Re: Could some one check my code
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-171032@lists.php.net to get a copy of this message
On Wed, Nov 26, 2003 at 11:23:19AM -0000, PAUL FERRIE wrote: : : i am getting this error returned but i dont know why :( : error: : : Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result : resource in /home/pferrie/public_html/vinrev/adm/insert2.php on line 6 : : php file : <?php : include("connection.php"); : if(!empty($rating)){ : $query="SELECT * FROM $tablename WHERE rating = '$rating'"; : if(mysql_query($query)) { : $myrow = mysql_fetch_array($query);// This line returns an error! mysql_query() might fail, in which case it returns a boolean FALSE. You should first check whether the query succeeded or failed. $result = mysql_query($query); if ($result === false) { // query failed, report the error echo mysql_error(); } else { // query succeeded, do your thing }

« previous php.general (#171032) next »