Forum Moderators: coopster
Any ideas?
Travis
Anyhoo, let's get on it:
So you have your page and you want to list the details:
<?php
// split ur array
$array = array_chunk($arrayfromsomewhere,"10",true);
// add links; we're assuming 'show' var is passed in the url to determine what page is shown
if (!$_GET['show']) {
echo "<a href=\"file.php?show=1\">next page</a>";
} else {
// let's show the data
foreach ($array[$_GET['show'] as $v) {
echo $v."<br />";
}
// finish up with the links
// check the arrays: if a chunk less than get:show exists, then they can go back. same for if a chunk greater than get:show exists, they can go forward
if (!empty($array[$_GET['show'] + 1)) {
// show next link
echo "<a href=\"file.php?show=".($_GET['show'] + 1)."\">next</a>";
}
if (!empty($array[$_GET['show'] - 1)) {
// show previous link
echo "<a href=\"file.php?show=".($_GET['show'] - 1)."\">previous</a>";
}
}
// finished
?>
Hope it works!