Liquid Fire Posted November 22, 2006 Share Posted November 22, 2006 I am looking to cylce through X amount of returned entries from a mysql table displaying X at a time. Baically what forums do. example:I have 100 new item and what to display 10 per page, how would I create the link to display the next 10 and reload that same page with those next 10 entries? Link to comment https://forums.phpfreaks.com/topic/28126-cylcing-through-mysql-entries-with-php/ Share on other sites More sharing options...
Psycho Posted November 22, 2006 Share Posted November 22, 2006 Go to the home page for this site and go to the tutorial section. There are a few tutorials on pagination. Link to comment https://forums.phpfreaks.com/topic/28126-cylcing-through-mysql-entries-with-php/#findComment-128631 Share on other sites More sharing options...
drkslvr8 Posted November 22, 2006 Share Posted November 22, 2006 In a nutshell:[list][*]Start your page with something like [tt]$offset = $_GET['offset'][/tt][*]In your MySQL query include something like [tt]"limit = {$offset},10"[/tt][*]At the top of your page, write something like [tt]$next10 = $offset + 10;[/tt] and [tt]$last10 = $offset - 10;[/tt][*]At the bottom of your page, print links something like [tt]"<a href=\"thispage.php?offset={$next10}\">Next</a>"[/tt] and [tt]"<a href=\"thispage.php?offset={$last10}\">Previous</a>"[/tt][/list]That should cover it. Link to comment https://forums.phpfreaks.com/topic/28126-cylcing-through-mysql-entries-with-php/#findComment-128824 Share on other sites More sharing options...
drkslvr8 Posted November 22, 2006 Share Posted November 22, 2006 Sorry. The parsing messed up my examples. I should have previewed it first, but I think you can still get the point. Link to comment https://forums.phpfreaks.com/topic/28126-cylcing-through-mysql-entries-with-php/#findComment-128826 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.