Skip to content
Advertisement

best way to get large data from database with pagination in php?

I have a large amount of data in PHP. like I’m developing properties web app. In the database, we have thousands of rows in the database. I’m using

$select = "SELECT * FROM properties limit $page_first_result, $results_per_page";

limit query with pagination. Is this the best way to handle a large amount of data? or there is another way to handle it?

Advertisement

Answer

The best practice and best ways in pagination is using the limit and offset and also optimizing the output.

Also Pear::Pager can help with the output, and to limit the database traffic to only what you need, you can use a wrapper provided in the examples that come with it.

you may take a look at this article too. it’s providing data about Optimized Pagination using MySQL, making the difference between counting the total amount of rows, and pagination.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement