Ordinary_Shepp Posted April 3, 2014 Share Posted April 3, 2014 (edited) Hello, I am doing a project where I need to store a large volume of data in a table. So, I can't show all the data at a time. And performing a query for all those data may be time consuming. So I want to implement a view system where I can show data step by step. Say I want to show last 50 data at a time. So, It seems that I need to traverse through the rows with two button. "Previous" and "Next" . What could be the query for this purpose or how I can do it? I am using mysql and php. I am not expecting a bunch of code. But I will appreciate your comment with necessary functions for php and query ideas or examples for mysql and viewing procedure for HTML. Edited April 3, 2014 by Ordinary_Shepp Quote Link to comment https://forums.phpfreaks.com/topic/287493-retrieve-the-last-n-element-of-the-database/ Share on other sites More sharing options...
Solution Psycho Posted April 3, 2014 Solution Share Posted April 3, 2014 What you are referring to is called pagination. How you achieve this requires more than just a query (you need two queries plus PHP code to manage it). There are tons of tutorials on how to accomplish this. There used to be one on this site, but it looks like they've removed them all. Just Google "PHP pagination tutorial" Quote Link to comment https://forums.phpfreaks.com/topic/287493-retrieve-the-last-n-element-of-the-database/#findComment-1474823 Share on other sites More sharing options...
Ordinary_Shepp Posted April 3, 2014 Author Share Posted April 3, 2014 (edited) Thanks man, I didn't know my necessary keyword for googling..... Edited April 3, 2014 by Ordinary_Shepp Quote Link to comment https://forums.phpfreaks.com/topic/287493-retrieve-the-last-n-element-of-the-database/#findComment-1474824 Share on other sites More sharing options...
Psycho Posted April 3, 2014 Share Posted April 3, 2014 (edited) Sure thing. Post back if you run into any problems/questions after reviewing a tutorial or two. EDIT:When I clicked the Tutorials tab on this site, it is empty of content. But, when I just did a Google search, the PHP Freaks tutorial was the second result and can be accessed here: http://www.phpfreaks.com/tutorial/basic-pagination Edited April 3, 2014 by Psycho Quote Link to comment https://forums.phpfreaks.com/topic/287493-retrieve-the-last-n-element-of-the-database/#findComment-1474825 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.