So I keep getting the error... Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 35 bytes) in /home/jordana/public_html/work/php/pagination/index.php on line 50 Code (markup): Which to my knowledge is cause by a infinate loop. However from what I see the loop should be fine. Can anyone see anything wrong with this? $numRows = $allMsgs->num_rows; $numPages = round($numRows/10); $pageStarts = array(); for($i = 0; $i <= ($numPages + 1); $i+10) { array_push($pageStarts, $i); if($i==0) { $i++; } else { } } PHP:
Thanks. That fixed it numPages is just an integer which says how many pages need to be made based on the number of rows and rows per page.
Its also bad programming practice to modify a for counter in your loop. Practice good coding habits, and make your life easier! If you need to start at 1, just initialize the counter that way.