Yes Mike, but if it's a larger database you might wanna use the
functions in MySQL instead. Then you will save time and memory by not
selecting everything everytime and then process it in php.

Take a look at 7.4.9 in MySQL doc
(http://www.mysql.com/doc/M/a/Mathematical_functions.html).

/Johan

Michael Rudel wrote:
> 
> Hi Afan.
> 
> U can use the ceil() -function.
> Look in the manual @section: XXXIII. Mathematical Functions
> 
> Greetinx,
>   Mike
> 
> Michael Rudel
> - Web-Development, Systemadministration -
> _______________________________________________________________
> 
> Suchtreffer AG
> Bleicherstraße 20
> D-78467 Konstanz
> Germany
> fon: +49-(0)7531-89207-17
> fax: +49-(0)7531-89207-13
> e-mail: mailto:[EMAIL PROTECTED]
> internet: http://www.suchtreffer.de
> _______________________________________________________________
> 
> > -----Original Message-----
> > From: afan [mailto:[EMAIL PROTECTED]]
> > Sent: Friday, April 27, 2001 10:38 PM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP-WIN] need your opinion
> >
> >
> > 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
> >
> 
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to