note 35050 deleted from function.round by didou
| From: | didou@php.net | Date: | Thu, 09 Oct 2003 10:02:54 +0000 |
| Subject: | note 35050 deleted from function.round by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-58098@lists.php.net to get a copy of this message | ||
Note Submitter: limit0.com
----
Here is how to always round up...
$x = (a/b);
$r = round($x);
$d = ($x-$r);
if ($d>0){
$x = ($r+1);
}
I had to use this for a directory page list I.E: "1 - 2 - 3 - 4 - 5 - NEXT >" where
people search 20 things per page and it was not showing me the last page since it had less than 20
things...
a equaled the number of rows in a mysql table
b equaled the amount of things i want the user to see per page
x is used to add the "1 - 2 - 3 - 4 - 5 - NEXT>" using a loop.
Hope this helps someone.
http://www.limit0.com/games/files/gamelist.php
is the file it was for.