On 5/27/07, Eduardo Vizcarra <evizcarra@xxxxxxxx> wrote:
Hi All I am developing a web site that interacts with a MySQL database. When I run a query and display the records in a web page, this can become a problem because there might be too many records to be displayed in one single web page so I am trying to divide the total number of records and display them in multiple pages. Let's say, if the query returns 100 records then I would like to display the first 10 records and then put a navigation bar where I can go to the next 10 or return to the previous 10 records Is this done at a SQL or PHP level ? any experience on doing this ? Thanks a bunch Eduardo
Ik could be done with both, you could use the LIMIT option in your SQL code, or just fetch all and only output 10 (using php). I would prefer the first one, as it won't send all records, but only the ones you need. This save some time when interacting with the database. Of course you won't note the difference with 100-200 pages, but when it becomes more and more (think about atleast 10000+) then you probably will note the speed difference. Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php