PHP or ColdFusion

Discussion in 'Programming' started by Web Gazelle, Jul 25, 2005.

  1. #1
    Anyone know what the command is to limit a query to 25 results for that page? I can't think of it right now so anyone who can help, it would be much appreciated.
     
    Web Gazelle, Jul 25, 2005 IP
  2. UndiesHosting

    UndiesHosting Active Member

    Messages:
    219
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    78
    #2
    i assume you mean from a database. if you are using mysql you just add "limit 25" to the end of your sql statement
     
    UndiesHosting, Jul 25, 2005 IP
  3. Web Gazelle

    Web Gazelle Well-Known Member

    Messages:
    3,590
    Likes Received:
    259
    Best Answers:
    0
    Trophy Points:
    155
    #3
    Thats right it is from a DB. The ColdFusion statement grabs the info using the Get command and the where command to say what info to get would I put "limit 25" in the where info. so it says "where category= community limit 25"
     
    Web Gazelle, Jul 25, 2005 IP
  4. UndiesHosting

    UndiesHosting Active Member

    Messages:
    219
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    78
    #4
    yes so if you were asking

    select id from customer where name = 'mike'

    you could then change it to

    select id from customer where name = 'mike' limit 25
     
    UndiesHosting, Jul 25, 2005 IP
  5. Web Gazelle

    Web Gazelle Well-Known Member

    Messages:
    3,590
    Likes Received:
    259
    Best Answers:
    0
    Trophy Points:
    155
    #5
    OK that helps. That was what I was thinking, Now How about limiting the next page to results 26-50? And so on and so forth. :D
     
    Web Gazelle, Jul 25, 2005 IP
  6. UndiesHosting

    UndiesHosting Active Member

    Messages:
    219
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    78
    #6
    i havent had to do that in a while but there is something that goes right before limit that tells the quesry where to begin, something like offset

    i can't remember
     
    UndiesHosting, Jul 25, 2005 IP
    Web Gazelle likes this.
  7. Web Gazelle

    Web Gazelle Well-Known Member

    Messages:
    3,590
    Likes Received:
    259
    Best Answers:
    0
    Trophy Points:
    155
    #7
    If this helps go to the aquarium site in my signature and take a look at the community fish page. I want to limit it to showing 25 results then have a next link for results 26 to 50. I would continue that pattern for all of the results. Thanks for your help with this, UndiesHosting.
     
    Web Gazelle, Jul 25, 2005 IP
  8. Web Gazelle

    Web Gazelle Well-Known Member

    Messages:
    3,590
    Likes Received:
    259
    Best Answers:
    0
    Trophy Points:
    155
    #8
    Quick update on my question. I was able to search Google for tutorials on Offset and Limit in SQL. Thanks for the help.
     
    Web Gazelle, Jul 25, 2005 IP