SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Wizard Darren884's Avatar
    Join Date
    Aug 2003
    Location
    Southern California, United States
    Posts
    1,616
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to select a random row from a table?

    How would I do this?

  2. #2
    SitePoint Enthusiast Niakie's Avatar
    Join Date
    Mar 2004
    Location
    Ontario
    Posts
    86
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Not sure about other databases, but with MySQL you can do something like

    Code:
    SELECT * FROM table ORDER BY RAND() LIMIT 1;


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
  •