MySQL Forums
Forum List  »  Optimizer & Parser

count(*) versus mysql_num_rows
Posted by: nachomonterde
Date: November 21, 2005 03:54PM

Hello!
If I want to know the number of rows of a certain table, what is it better?

=>$table=mysql_query("select * from mytable"); $number_of_rows=mysql_num_rows($table);

or

=>$row=mysql_fetch_array(mysql_query("select count(*) as howmany from mytable")); $number_of_rows=$row["howmany"];


Thank you very much.

Options: ReplyQuote


Subject
Views
Written By
Posted
count(*) versus mysql_num_rows
27336
November 21, 2005 03:54PM
7189
November 24, 2005 09:18AM
7723
June 02, 2006 04:13AM
5286
June 08, 2006 09:41AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.