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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux