Jump to content

round 3.1 up to 4


upp

Recommended Posts

hello guys, im creating a search result page that uses pagination, and im trying to figure out how many total pages their are going to be in my links with the page numbers. this is probably something really simple, ive been writing scripts for the last few hours and have a bit of a headache, any help would be appreciated here's the coding and the results i want:

 

<?php

$per_page = 10;
$rows = mysql_query("SELECT COUNT(*) FROM articles WHERE text LIKE $string"); // this will return 31
$pages = $rows / $per_page; // returns 3.1
$total_pages = round($pages); // returns 3, want to round 3.1 up to 4 here

?>

Link to comment
https://forums.phpfreaks.com/topic/219185-round-31-up-to-4/
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.