Michan Posted December 9, 2007 Share Posted December 9, 2007 Hi all, Say I have an array of twenty results; how would I output, for example, results # 5 - 10 (for pagination)? Here is 1 - 5: $i = 0; foreach($topiclist as $key => $val) { echo $val.'<hr>'; if(++$i==5) { break; } } Many thanks in advance, - Mi Quote Link to comment Share on other sites More sharing options...
rab Posted December 9, 2007 Share Posted December 9, 2007 <?php $offset = (int)$_GET['page']; $size = 10; $topics = array_slice($topiclist, $offset, $size); foreach($topics as $key => $val) echo "$val<hr>"; ?> Try something like that. Quote Link to comment Share on other sites More sharing options...
Michan Posted December 9, 2007 Author Share Posted December 9, 2007 Thanks, works perfectly Solved! Quote Link to comment 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.