Guest Posted October 16, 2009 Share Posted October 16, 2009 Hi guys, I am struggling with some code for a couple of days and can't figure out what to do. I have to admit that I am pretty new at php. Here is my issue. I have a table in my database recording all the news of my website. Pretty simple table with these fields: id menu_name visible content So pretty simple to display all the news on my website. But I guess I will have some trouble when I will have lots of news, showing a long page of news. How can I display these news so that only 10 news appear on page 1 and just below, people can go to other pages? Thanks in advance for your help guys... Link to comment https://forums.phpfreaks.com/topic/177889-breaking-records-into-pages/ Share on other sites More sharing options...
waynew Posted October 16, 2009 Share Posted October 16, 2009 What you're looking to achieve is called "Pagination". There's a tutorial written by one of the moderators of PHPFreaks on the front-end of the site. Here's a link to it Link to comment https://forums.phpfreaks.com/topic/177889-breaking-records-into-pages/#findComment-937916 Share on other sites More sharing options...
Guest Posted October 16, 2009 Share Posted October 16, 2009 Thanks a lot mate. Must have done a wrong search earlier not to find this subject... Link to comment https://forums.phpfreaks.com/topic/177889-breaking-records-into-pages/#findComment-937936 Share on other sites More sharing options...
Guest Posted October 16, 2009 Share Posted October 16, 2009 Hi it's me again... I managed to make the pagination work and I managed to customize it perfectly... The thing is, I have my news displayed on the left of the screen of a edit_subject.php file, with a max of 5 per page. When I want to see the news from 6 to 10, it works well and show edit_subject.php?currentpage=2. But when I click on one subject line to edit it (the edition is on right of the same page), it turns into edit_subject.php?subj=7 (for example), and the pagination goes back to the page 1. So my question would be: how could I do to keep the pagination at the same page where I want to edit my subjects? Sorry for of these questions, I am pretty new to all this... Link to comment https://forums.phpfreaks.com/topic/177889-breaking-records-into-pages/#findComment-938060 Share on other sites More sharing options...
dymon Posted October 16, 2009 Share Posted October 16, 2009 You can just keep both IDs: edit_subject.php?subj=7¤tpage=2 So you will always know where you are. Link to comment https://forums.phpfreaks.com/topic/177889-breaking-records-into-pages/#findComment-938063 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.