Re: how do you fund out if a mysql resource is empty?
| From: | Stuart Dallas | Date: | Fri, 13 Jan 2012 20:05:17 +0000 |
| Subject: | Re: how do you fund out if a mysql resource is empty? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-316293@lists.php.net to get a copy of this message | ||
On 13 Jan 2012, at 20:01, Haluk Karamete wrote:
> $result = mysql_query($sql,$link) or die(mysql_error());
>
> how do you find out if $sql returned any recordsets?
> is there a fast/super efficient way of finding this out... something
> along the lines of is_empty($result) type thing?
if (mysql_num_rows($result) > 0) {
...
}
http://php.net/mysql_num_rows
And while you're there, have a browse of the function list in the left column.
-Stuart
--
Stuart Dallas
3ft9 Ltd
http://3ft9.com/