I would like to include a random quotation from a mysql database on my homepage. The table has 3 fields: id, quote, and author. Is there a way to randomly select a row from the table?
Get the max id # and use rand() to get your random number between 1 and the max # (remember to seed it first). Then, use the random # to select your quote from mysql.
Kai
You could try something like this
SELECT id, quote, author, id*0+rand() as random FROM table ORDER BY random LIMIT 1
I don't think the rand function works on its own, hence the id*0+rand().