Hi,

I have an MySQL query which is seems to work fine with a PDO execute and I want to make paging to the results. I want to show the total number of results also. If I make paging by adding "limit :rownumber, :rowperpage" to the end of the query, I have to execute another query to get the total count number. If I don't, I don't know how to make paging. Any ideas?


Code:
$searchquery = "Select propertycode,title,price,currency,altbolgeadi,bolgeadi,description,bedrooms,bathrooms from urunler where bolgeID=:location and altbolgeID=:sublocation and price between :pricemin and :pricemax limit :sayfa, :gosterim";
$stmt = $db->prepare($searchquery);
$stmt->execute($degerler);
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
$rowcount = count($rows);
In above code, if I keep the limit section $rowcount becomes the limit given to MySQL. If I don't, I don't know how to make paging with the $rows results.

Many thanks