Probably an easy question...

Discussion in 'PHP' started by twistedspikes, May 11, 2008.

  1. #1
    So i'm trying to display at random only the information for one row of the MYSQL table and i'm not sure how i'd go about doing this.

    I'm extracting rows where featured = 'yes', then I want to display a random row from what is left.

    Would I have to extract all the rows where featured = 'yes', put them into an array and then take a random one and display it's info? Or is there an easier way to do it that i'm overlooking?

    Thanks in advance for any help,
    TS
     
    twistedspikes, May 11, 2008 IP
    buffalo likes this.
  2. Demon fox

    Demon fox Active Member

    Messages:
    703
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    78
    #2
    Order By Rand() Limit 1
     
    Demon fox, May 11, 2008 IP
    twistedspikes likes this.
  3. twistedspikes

    twistedspikes Notable Member

    Messages:
    5,694
    Likes Received:
    293
    Best Answers:
    0
    Trophy Points:
    280
    #3
    Oh, thank you :)
     
    twistedspikes, May 12, 2008 IP