Possible Duplicate:
How can I count the numbers of rows that a mysql query returned?
To get the length of the return of a mysql result, I am using:
$counter=0;
while($row = mysql_fetch_array($mysqlqueryresult)){
$counter++;
}
echo $counter;
Is there a better way to get the number of rows returned by mysql?
Note - Not allowed to use COUNT in the mysql or any mysql tricks, only php on the mysql output as here. So starting point is a mysql returned thing of $mysqlqueryresult;
which itself is the result of a basic SELECT
query.