Hello Chris,

Tuesday, March 30, 2004, 3:12:26 AM, you wrote:

CW> how would one go about determining the number of rows in a mysql table,
CW> without actually wasting the time of querying for *.

CW> is this the best way?

CW> $result = mysql_query('SELECT * FROM tablename');
CW> $num_rows = mysql_num_rows($result);

SELECT COUNT(*) AS hits FROM tablename

The row count will be in "hits" in $result. Count is a much faster way
for MySQL to give you the number you want without actually selecting
all the data in the process.

-- 
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to