hi,
I have query to select products for specific category from DB, something
like:
SELECT prod_id, prod_name,...
FROM products
LIMIT $From, $To

where $From and $To values depend of on what page you are. let say there
are 100 products and I'm listing 25 products per page. for page 1 $From=0,
$To=24. for page 2 $From=25 and$To=49, etc.

works fine.

though, to calculate how many pages I have I need total number of records.
do I have to run first a query (something like SELECT COUNT(*) as
NoOfRecords FROM products) and then query above or there is solution to
have both info using one query?

as a solution, I can run a query to grab all records and then list just 25
products but I think it's not so smart idea :)

thanks for any help.

-afan

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to