SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member moneybyus's Avatar
    Join Date
    Mar 2001
    Location
    MN
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I need to know how I can show only 10 banners at a time and have next/prev links after the 10. Showing over 80 banners on one page takes a little too long. Ive searched the forums and didnt really come up with anything that helps. Thanks.

  2. #2
    ********* wombat firepages's Avatar
    Join Date
    Jul 2000
    Location
    Perth Australia
    Posts
    1,717
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Would depend on how you are getting the banners in the first place, ie are you pulling them out of a db? in which case you can add a LIMIT to your query etc , or just grabbing all the banners out of a given directory, in which case you can effectively limit how many you grab at a time - or are you using a banner management system?

    knowing how you are currently working will help.

  3. #3
    SitePoint Member moneybyus's Avatar
    Join Date
    Mar 2001
    Location
    MN
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm pulling them out of a mysql database. What I want to do is use a form to pick a catagory, then call the banners in that catagory and either have a radio button next to each one to select which one to edit.
    The way I had in mind was to call all of them in the catagory, like this:

    Select * from banners where catagory = '$catagory'

    $catagory being the catagory I picked in a previous form.

    Then only show ten at a time and have a next button to show the next ten and so on.

    If there is a better way to do this, then I'd like to know, but the main thing Id like to know is how to only show the ten at a time.

    Sorry I didnt explain before.

  4. #4
    SitePoint Addict kunal's Avatar
    Join Date
    Oct 2000
    Posts
    307
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you could try this

    $offset = 1; // from which id to which id
    $limit = 10; // maximum to select at a time
    $sql = "Select * from banners where catagory = '$catagory' LIMIT $offset, $limit";
    $offet = $offset + $limit;
    i dunno...

  5. #5
    <? echo "Kick me"; ?> petesmc's Avatar
    Join Date
    Nov 2000
    Location
    Hong Kong
    Posts
    1,508
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ...And for the next page links you would use:

    Code:
    <?php
    print "<a href='$PHP_SELF?offset=$offset'>Next</a>
    ?>


Bookmarks

Posting Permissions

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