Possible Duplicate:
How to request a random row in SQL?
Is this the correct way to do this?
$query = 'SELECT * FROM gameids ORDER BY timestamp RAND LIMIT 1';
                Incorrect. You cant order by a column (afaik) if you want it to randomize.
$query = 'SELECT * FROM gameids ORDER BY RAND() LIMIT 1';
                        You don't need to tell it which column to randomise, but you do need () after RAND because it is a function.
SELECT
  * 
FROM
  gameids 
ORDER BY 
  RAND()
LIMIT 1
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With