Re: Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource

From: Date: Tue, 26 Apr 2005 16:09:15 +0000
Subject: Re: Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-213938@lists.php.net to get a copy of this message
Mark Sargent wrote:
*Warning*: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in */var/www/html/phpmysqltable.php* on line *36* Below are snippets of my code, Line 22: $result = mysql_query("SELECT product_name, product_model_number, product_serial_number FROM Products",$db); Line 36: while ($myrow = mysql_fetch_row($result)) {
mysql_query() returns false on failure, and false isn't a valid MySQL result resource. A quick and dirty way to alert yourself to the problem is to change line 22 to this: $result = mysql_query('SELECT product_name, product_model_number, product_serial_number FROM Products', $db) or exit(mysql_error()); Hope that helps. Chris -- Chris Shiflett Brain Bulb, The PHP Consultancy http://brainbulb.com/

« previous php.general (#213938) next »