Results 1 to 3 of 3
  1. #1
    Full Member dak142's Avatar
    Join Date
    January 18th, 2005
    Posts
    386
    Anyone know how to use the 'select' statement in PHP to choose random records. I want 25 different results to display each time but I can not find a way to do it.

    Thanks,
    David

  2. #2
    ABW Ambassador cditty's Avatar
    Join Date
    January 18th, 2005
    Location
    Memphis TN
    Posts
    1,434
    This is how I do it.

    select column1, column2, column3, etc, etc,etc, column1*0+RAND() AS randNum
    from tablename
    order by randNum
    limit 25

    Chris
    Recycled Talent - Architects of custom scripts and snippets, perfectly written to suit any need. We stay on top of the latest technology so you don't have to.
    Total Stupidity - Shining light on stupid things.

  3. #3
    "An Englishman In New York" TJ's Avatar
    Join Date
    January 18th, 2005
    Posts
    3,282
    I do it similarly.....

    select column1, column2, column3, etc, etc,etc
    from tablename
    order by rand()
    limit 25

  4. Newsletter Signup

+ Reply to Thread

Similar Threads

  1. PHP question - include(file.php) with variables
    By teezone in forum Programming / Datafeeds / Tools
    Replies: 8
    Last Post: September 4th, 2009, 04:54 PM
  2. Random Products
    By jackson992 in forum Programming / Datafeeds / Tools
    Replies: 2
    Last Post: February 21st, 2007, 02:00 AM
  3. Being Logged Out at Random
    By La_Valette in forum Commission Junction - CJ
    Replies: 6
    Last Post: November 19th, 2005, 01:45 PM
  4. Random HTML
    By drumminlogan in forum Programming / Datafeeds / Tools
    Replies: 4
    Last Post: December 23rd, 2002, 07:26 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •