tags:

views:

30

answers:

1

Hi.

How can I check how many results is returned from mysql db?

Im using this code to fill a table with results from the mysql db:

   $qry_result = mysql_query($query) or die(mysql_error());
   while($row = mysql_fetch_array($qry_result))

Im want to display how many search results there was on the users search criteria...

Thanks

+7  A: 

Use mysql_num_rows.

$num_of_results = mysql_num_rows($qry_result);

It works for SELECT or SHOw. If the query is INSERT, UPDATE, REPLACE or DELETE use mysql_rows_affected.

Lukasz Lysik