I have the following query:
$sql = "SELECT product_name FROM products,product_brand_category WHERE products.product_id = product_brand_category.product_id AND brand_id='9' AND category_id='5'";
$result = mysql_query($sql)
or die ("Could not execute query" . mysql_error());
while ($row = mysql_fetch_array($result))
{
extract($row);
echo"$product_name";
}
What I would like to do is have some way of finding out how many rows match the search criteria and being able to assign this value to a variable, but without having to actually process every row.
I think it can be done with SELECT FOUND_ROWS(), however am not sure how. Can anyone five me some pointers please?
Thanks!
$sql = "SELECT product_name FROM products,product_brand_category WHERE products.product_id = product_brand_category.product_id AND brand_id='9' AND category_id='5'";
$result = mysql_query($sql)
or die ("Could not execute query" . mysql_error());
while ($row = mysql_fetch_array($result))
{
extract($row);
echo"$product_name";
}
What I would like to do is have some way of finding out how many rows match the search criteria and being able to assign this value to a variable, but without having to actually process every row.
I think it can be done with SELECT FOUND_ROWS(), however am not sure how. Can anyone five me some pointers please?
Thanks!