Query: how to use sizeof or count on mysql_fetch_array($result) to count the number of rows...
Detail:
I am trying to find how many records are returned from a search without walking through the result. It is such an obvious thing to want to do, I am sure there must be an easy way - but my search of the manual has come up with nothing.... Help would be very much appreciated.
I have something like this: (ignore the errors, this is just an example)
$result = mysql_query ("SELECT * FROM $table
WHERE name LIKE '$name'
") or die("");
if ($row3 = mysql_fetch_array($result)) {
do {
blah blah....
while($row = mysql_fetch_array($result));
} else {print "not found";
I want to know how many records I actually have, before I start printing them. That way I can determine whether I need to display the results over multiple pages.
Sizeof($row) and count($row) are of no use - they give me the number of elements in the record.....
Nick