quick php/mysql

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • alex79
    Confirmed User
    • Jun 2002
    • 996

    #1

    quick php/mysql

    i have a table with 1000 urls

    what is the easyest way to display 20 random url's?
  • Spudstr
    Confirmed User
    • Jan 2003
    • 2321

    #2
    use this query select * from TABLE order by rand() limit 20

    contact me if you want me to code somthing
    Managed Hosting - Colocation - Network Services
    Yellow Fiber Networks
    icq: 19876563

    Comment

    • alex79
      Confirmed User
      • Jun 2002
      • 996

      #3
      Originally posted by Spudstr
      use this query select * from TABLE order by rand() limit 20
      with his will be 20 consecutive urls? becouse i don't want to be consecutive

      Comment

      • Spudstr
        Confirmed User
        • Jan 2003
        • 2321

        #4
        no, it should pull 20 random rows open up a mysql client and run it a couple times.
        Managed Hosting - Colocation - Network Services
        Yellow Fiber Networks
        icq: 19876563

        Comment

        • fuzebox
          making it rain
          • Oct 2003
          • 22353

          #5
          Originally posted by alex79


          with his will be 20 consecutive urls? becouse i don't want to be consecutive
          That's what the "order by rand()" part is for ;)

          Comment

          Working...