easyedy Posted May 13, 2008 Share Posted May 13, 2008 HI I'm trying to add a pagination class to a multidimensional array but this class gives examples only for an SQL query and I can't figure out how to make the foreach paginate. Here is the code: How can I make this work with an huge array? require_once ‘paginator.class.php’; $pages = new Paginator; $pages->items_total = $db_count; $pages->mid_range = 7; $pages->paginate(); echo $pages->display_pages(); SELECT id, name, address FROM table ORDER BY id ASC $pages->limit What do I need to add to the foreach of the array to make it paginate? ie: foreach($pagenate as $row)… echo $pages->display_pages(); echo $pages->display_jump_menu(); echo $pages->display_items_per_page() What do I need to add to the foreach of the array to make it paginate? ie: foreach($pagenate as $row)… Link to comment https://forums.phpfreaks.com/topic/105490-pagination-with-multi-dimensional-array/ Share on other sites More sharing options...
Barand Posted May 13, 2008 Share Posted May 13, 2008 The problem with paginating an array is that the array disappears and needs recreating when the page reloads for the next page. Better to paginate using a query with a limit clause. Link to comment https://forums.phpfreaks.com/topic/105490-pagination-with-multi-dimensional-array/#findComment-540330 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.