Re: Count number of rows in table.

From: Date: Sun, 25 Aug 2002 19:11:25 +0000
Subject: Re: Count number of rows in table.
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-114071@lists.php.net to get a copy of this message
okay, so then a "select *" and then a num_rows ... On Sunday, August 25, 2002, at 10:11 AM, Jason Wong wrote:
On Sunday 25 August 2002 22:07, salamander wrote:
or, you should be able to simply do this, without the cost of fetching the results: $result = mysql_query("SELECT count(*) FROM table WHERE"); $num_rows = mysql_num_rows($result); echo "$num_rows Rows\n";
No. This only returns 1 row regardless. "SELECT COUNT(*) FROM ..." only returns a single row with a single column containing the row count. Using mysql_num_rows() on that will always return 1. -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* I'm going to Vietnam at the request of the White House. President Johnson says a war isn't really a war without my jokes. -- Bob Hope */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.general (#114071) next »