Re: Re: NMax

From: Date: Sun, 07 Nov 2004 09:35:45 +0000
Subject: Re: Re: NMax
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-201409@lists.php.net to get a copy of this message
count() is prefered over mysql_num_rows, because the later requires a full resultset to be tranfered, while the first doesn't. (so, the 2nd is more resource intensive if you don't require the resultset) nate@savingadvice.com wrote:
Yeah definitely use COUNT(*) or mysql_num_rows() function. Nate -----Original Message----- From: David Schlotfeldt [mailto:dmschlot@plauditdesign.com] Sent: Saturday, November 06, 2004 9:19 PM To: php-general@lists.php.net Subject: [PHP] Re: NMax You could do it in a SQL statement SELECT COUNT(*) FROM table_name; This is less system intensive. David John Taylor-Johnston wrote:
I might add, I do this, think there must be a better way? $mycounter = 0; while ($mydata = mysql_fetch_object($news)) { $mycounter++; } John Taylor-Johnston wrote:
How can I calculate how many records I have in a table? John


« previous php.general (#201409) next »