need your opinion
| From: | afan | Date: | Fri, 27 Apr 2001 20:37:49 +0000 |
| Subject: | need your opinion | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-7102@lists.php.net to get a copy of this message | ||
Hi all,
I made a simple code but I think that there is a better way to do same thing.
I have list with couple hundreds "entries" and I want to have it 50 per page.
I did it this way and it works.
$result = mysql_query("SELECT id FROM source ORDER BY id ASC", $db);
while($myrow = mysql_fetch_array($result))
{
$IDArray[] = $myrow[id];
}
$NoOfEntries = count($IDArray); // Number of entries
$NoOfPages = $NoOfEntries / 50; // Number of pages with 50 entries per page
// E.g. 3.854 pages means 4 pages. The way I'm doing is check is $NoOfPages >
integer($NoOfPages)
$NoOfPagesInt = $NoOfPages;
settype($NoOfPagesInt, "integer");
if($NoOfPages > $NoOfPagesInt):
$NoOfPages++;
endif;
Any suggestions?
Thanks!
Afan