Mysql how many search results
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_quer开发者_JAVA百科y($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
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
.
精彩评论