mysql_fetch_array(): issue

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
itsmani1
Forum Regular
Posts: 791
Joined: Mon Sep 29, 2003 2:26 am
Location: Islamabad Pakistan
Contact:

mysql_fetch_array(): issue

Post by itsmani1 »

Code: Select all

<?PHP
			$caRes = mysql_query("select * from catart") or die(mysql_error());
			while($caRes = mysql_fetch_array($caRes))
			{
				print_r($caRes);
			}
		?>
i get this error:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in D:\Webspace\admins\addArticle.php on line 51

please help
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

try

Code: Select all

$caRes = mysql_query("select * from catart") or die(mysql_error());
echo __FILE__,'@',__LINE__,': ', gettype($caRes);
while($caRes = mysql_fetch_array($caRes))
{
	print_r($caRes);
}
User avatar
itsmani1
Forum Regular
Posts: 791
Joined: Mon Sep 29, 2003 2:26 am
Location: Islamabad Pakistan
Contact:

Post by itsmani1 »

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in
this is the result.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

and the echo was ignored or did not print anything? Or has the code snippet you showed us maybe, just maybe nothing to do with the message you get?
Post Reply