SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    May 2001
    Posts
    31
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How Do you limit a number of profiles displayed on a page???

    Hi all,
    Can anyone tell me how to limit the number of profiles that are pulled on one page???

    For example I am trying to get ten profiles to appear on one page but if more queries than ten match someones search I would like the page to cut off at ten and give a next ten link at the foot of the page....


    Any help would be appreciated, it is in relation to another question a few weeks ago which was how do you get images to be called from a database.

  2. #2
    SitePoint Wizard johnn's Avatar
    Join Date
    Mar 2001
    Location
    Southern California, USA
    Posts
    1,181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Sapper,

    To get the first 10 records by date in descending order:

    $offset = 0;
    SELECT * FROM tablename ORDER BY date_published desc
    LIMIT $offset, 10

    Say all your images are stored in images directory in yourproject folder, then your image name is
    row['imagename'] that you get from database.

    Store an image name in table above and you have it when you select articlename, imagename, date from tablename...

    print ("<img src="/yourproject/images/<?= row[imagename]) ?>" align="left">");

    John

  3. #3
    SitePoint Wizard
    Join Date
    Jul 1999
    Location
    Chicago
    Posts
    2,629
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    [edit] oops, johnn beat me, and has a much better description
    Last edited by qslack; Jun 3, 2001 at 11:31.

  4. #4
    SitePoint Enthusiast
    Join Date
    May 2001
    Posts
    31
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanx guys I will try that and let you know


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
  •