createing dynamic new pages

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jungabunga
    New Member
    • Mar 2007
    • 15

    createing dynamic new pages

    Heya guys,

    I an having trouble building a page that dynamically expands.

    The page fundimentally works fine, but at the moment i am storing about 45 image locations in my db.

    I am having real difficulty finding some understandable examples of how to account for a potentially infinite number of images so the user can view the gallery say 20 images at a time on a page to cut down loading - currently thay are all on one page. i know, not good :( .

    thx again for ur help
  • merseyside
    New Member
    • Mar 2007
    • 48

    #2
    Originally posted by jungabunga
    Heya guys,

    I an having trouble building a page that dynamically expands.

    The page fundimentally works fine, but at the moment i am storing about 45 image locations in my db.

    I am having real difficulty finding some understandable examples of how to account for a potentially infinite number of images so the user can view the gallery say 20 images at a time on a page to cut down loading - currently thay are all on one page. i know, not good :( .

    thx again for ur help
    You'll probably need to run two queries against your database. The first to get the count of images that may be returned. The second to return x images per page. Knowing these two values you should be able to estimate the total number of pages the images are spread over. As you move from page to page alter the second query to return the appropiate subset of images.

    Comment

    • Motoma
      Recognized Expert Specialist
      • Jan 2007
      • 3236

      #3
      The solution depends on what type of database you are using.
      MySQL supports the LIMIT syntax, which is used like this:

      Code:
      SELECT
          *
      FROM
          images
      LIMIT 5,30
      This will retrieve 30 rows beginning at row 6.

      MSSQL has the TOP clause, and other DBMS have similar syntaxes.

      Comment

      • jungabunga
        New Member
        • Mar 2007
        • 15

        #4
        thanks guys, i'll have a closer look at those

        Comment

        Working...