page integer problem

This is a discussion on "page integer problem" within the PHP Forum section. This forum, and the thread "page integer problem are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Jul 5th, 2006, 13:30
New Member
Join Date: Jun 2006
Location: Portsmouth, UK
Age: 22
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to rtswimmer
page integer problem

Basically ive written code that looks in a directory and lists all the jpeg files.
I have 13 files however i only want 12 to a page.

Code: Select all
 $pages = $files / 12;
So i want it to set $pages = 2
But it sets $pages = 1.08333333333. which is correct but i want the next integer.

So ive tried
Code: Select all
 $pages = (int) ($no / 12);
but that just sets $pages = 1



can anyone help me to find the next integer?
Reply With Quote

  #2 (permalink)  
Old Jul 5th, 2006, 13:55
Up'n'Coming Member
Join Date: Feb 2006
Location: London
Age: 25
Posts: 98
Thanks: 0
Thanked 0 Times in 0 Posts
Re: page integer problem

Hello,

Use ceil() to round a number up.

ceil($pages)

Cheers,
Jim.
Reply With Quote
  #3 (permalink)  
Old Jul 5th, 2006, 14:39
New Member
Join Date: Jun 2006
Location: Portsmouth, UK
Age: 22
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to rtswimmer
Thumbs up Re: page integer problem

Worked a treat!

cheers Jimz
Reply With Quote
Reply

Tags
page, integer, problem

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP integer form validation CloudedVision PHP Forum 3 Feb 24th, 2008 20:09
problem accessing page number9 Starting Out 4 May 25th, 2007 05:30
Problem with my contact page tlynn721 Classic ASP 5 Aug 9th, 2005 00:50
Assign string values to integer values of a session variable Andy K Classic ASP 1 Jul 13th, 2005 08:29


All times are GMT. The time now is 12:03.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43