Page 1 of 1

paging an array

Posted: Thu Aug 18, 2005 5:04 am
by hame22
hi all,

I have an array of product codes $r

what i want to do is display a list of these codes but limit each page to just displaying 10 results, while using a paging system like << | 1 | 2 | >>

is this possible and any ideas on how to do this??


thanks

alex

Posted: Thu Aug 18, 2005 5:19 am
by Grim...
This should give you an idea:

Code: Select all

<?php

if (!$n)
{
	$n = 0;
}

for ($i = $n; $i <= $n + 10); $i++) 
{
	print $r[$i]."<br />";
}

$next = $n + 10;
$prev = $n - 10;

print "<a href="thispage.php?n=$next">Next Page</a><br />
<a href="thispage.php?n=$prev">Previous Page</a>";

?>
You should be able to expand on that to do what you want.

Posted: Thu Aug 18, 2005 6:20 am
by timvw
The best solution is to search this forum (or the complete internet) because you are not the first that asks this question..

Posted: Thu Aug 18, 2005 8:16 am
by feyd
search term: pagination