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
https://forums.phpfreaks.com/topic/99420-ceil/
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
https://forums.phpfreaks.com/topic/99420-ceil/#findComment-508773
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.