How do you get the number of records returned by a query?

pdjohnson - March 9, 2007 - 16:40

Simple enough question I guess but what is the best way to get the number of records returned by the likes of $queryResult = db_query($query); ????

Answer

pdjohnson - March 9, 2007 - 16:43

I worked it out.

$queryResult = db_query($query);
$cnt = db_num_rows($queryResult);

 
 

Drupal is a registered trademark of Dries Buytaert.