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 } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php