Re: determining number of rows in a mysql table
| From: | Richard Davey | Date: | Tue, 30 Mar 2004 10:13:31 +0000 |
| Subject: | Re: determining number of rows in a mysql table | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-181949@lists.php.net to get a copy of this message | ||
Hello Andy,
Tuesday, March 30, 2004, 6:48:47 AM, you wrote:
AB> $rows=mysql_query("select count(*) as count from users");
AB> $count=mysql_fetch_array($rows);
There's no need to extract the result into an array in this instance,
why bother giving PHP that extra overhead? Unless the query failed,
the value count will *always* exist at row 0, so you can simply do:
$count = mysql_result($rows, 0, 'count');
--
Best regards,
Richard Davey
http://www.phpcommunity.org/wiki/296.html