Reply to Re: [PHP] Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource

Your name:

Reply:


Posted by Chris Shiflett on 10/01/55 11:14

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/

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация