PHP Classes

Great job but...

Recommend this page to a friend!

      A simple pagination using MySQL  >  All threads  >  Great job but...  >  (Un) Subscribe thread alerts  
Subject:Great job but...
Summary:$_GET['page'] error when 1st time access
Messages:1
Author:Olivier Maloteau
Date:2009-07-27 23:18:19
 

  1. Great job but...   Reply   Report abuse  
Picture of Olivier Maloteau Olivier Maloteau - 2009-07-27 23:18:19
Hi,

Maybe I'm wrong but when you access for the first time to the page, your $_GET['page'] is not set that's why you have an error with this code :

elseif($_GET['page']>$this->pages) {
$start = $this->pages;
$end = $this->resultPerPage;
$this->query.= " LIMIT $start,$end";

To fix this, I add an isset :
elseif(isset($_GET['page'])>$this->pages) {
...

I have not tested the class with our example, I met this error perhaps because I've adapted the class to my controller class :)

Thanks for the code by the way :)