Re: mysql_numrows

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

 



Ron Piggott wrote:
When I do the following command:

$number_of_entries=mysql_numrows($blog_activity_result);

and there are no rows I get an error (Warning: mysql_numrows(): supplied
argument is not a valid MySQL result resource in ...)

Fix the error from $blog_activity_result as someone else mentioned.

If there are no rows returned from a query, mysql_numrows will return 0 - it will only show an error if you give it a bad link identifier.

eg

$query = "select * from table_that_doesnt_exist limit 1";
$result = mysql_query($query);
$rows = mysql_numrows($result); <-- will give an error

$query = "select * from table_that_is_empty limit 1";
$result = mysql_query($query);
$rows = mysql_numrows($result); <-- will return 0

--
Postgresql & php tutorials
http://www.designmagick.com/


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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux