Results 1 to 3 of 3
  1. #1
    Member
    Join Date
    January 18th, 2005
    Posts
    58
    Hello all,

    I am having a little problem generating a total page numbers for a search function I have.
    so far this is what I have.
    <pre class="ip-ubbcode-code-pre">
    $pagenum = (($items / 20) + 1);
    $totalpages = ($resultCount[0] / 20);
    </pre>
    The problem is that $totalpages returns numbers with decimals, ie 10.6. Is there anyway simply to round the result down or just eliminate the decimal?

    If you feel like you're in control you're not going fast enough - Mario Andretti

  2. #2
    ABW Ambassador
    Join Date
    January 18th, 2005
    Location
    Utah
    Posts
    1,141
    If you just want to round down (i.e., truncate the decimal off), try this:

    $totalpages = int ($resultCount[0] / 20);

    Michael

  3. #3
    Member
    Join Date
    January 18th, 2005
    Posts
    58
    Thanks EmDub
    sometimes my brain just stops working!
    I just remembered that this works
    <pre class="ip-ubbcode-code-pre"> $totalpages = ceil($resultCount[0] / 20);</pre>

  4. Newsletter Signup

+ Reply to Thread

Similar Threads

  1. PHP question - include(file.php) with variables
    By teezone in forum Programming / Datafeeds / Tools
    Replies: 8
    Last Post: September 4th, 2009, 04:54 PM
  2. need some php help
    By Larry in forum Programming / Datafeeds / Tools
    Replies: 4
    Last Post: April 5th, 2004, 06:07 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •