To get number of rows in result set there are two ways:
Is to use query to get count
$query=\"Select count(*) as count from some_table where type=
num_rows() would be better if you have small quantity of rows and count(*) will give you performance if there are large number of rows and you have to select one and send it to php.
num_rows()
count(*)