Jump to content

ceil()


Wildhalf

Recommended Posts

Hi

 

I am using a pagination script got from (http://phpsense.com/php/php-pagination-script.html)

 

It uses the following line to decided how many pages to display. I want to display all my pages and this line of code should do it but doesn't

 

The ceil function as i understand it should round up to the next integer.

 

$this->max_pages = ceil($this->total_rows/$this->rows_per_page);

 

There are 49 entries in my database and that should make max_pages = 5 but it only displays pages 1 2 3 4 but you can click the next arrow and it displays the fifth page but never sshow in in your list.

 

Can anyone tell me what i can change this code to to make sure it always rounds up to the next number.

Link to comment
Share on other sites

Try a quick debug.

 

echo $this->total_rows . ' / ' . $this->rows_per_page . ' = ' . $this->total_rows/$this->rows_per_page . ' ceil'd ' . ceil($this->total_rows/$this->rows_per_page) . '<br>';

$this->max_pages = ceil($this->total_rows/$this->rows_per_page);

echo $this->max_pages;

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.