note 25917 deleted from function.mysql-num-rows by googleguy
| From: | googleguy@php.net | Date: | Tue, 22 Oct 2013 09:04:12 +0000 |
| Subject: | note 25917 deleted from function.mysql-num-rows by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-196879@lists.php.net to get a copy of this message | ||
Note Submitter: webmaster at _NOSPAM_elite-gaming dot com
----
The fastest way to get the number of rows in a table is doing this:
$total = mysql_result(mysql_query("SELECT COUNT(id) FROM yourtable"),0);
As long as there are no NULL ids (shouldnt be), it will return the correct rows extremely fast. If
you already used yourtable though, it is faster to use mysql_num_rows() on the result of it.