note 25917 added to function.mysql-num-rows

From: Date: Fri, 11 Oct 2002 00:48:18 +0000
Subject: note 25917 added to function.mysql-num-rows
Groups: php.notes 
Request: Send a blank email to php-notes+get-37918@lists.php.net to get a copy of this message
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. -- http://www.php.net/manual/en/function.mysql-num-rows.php http://master.php.net/manage/user-notes.php?action=edit+25917 http://master.php.net/manage/user-notes.php?action=delete+25917 http://master.php.net/manage/user-notes.php?action=reject+25917

« previous php.notes (#37918) next »