- Generate A Mysql Results With One Query Order By Random
i will show you in this simple query example how to query the results by random order , Last Updated: Sun Jun 14, 2020
Mon Jul 18, 2011
hi, ok, today i was working on a script using php and mysql, i wanted to query my database and i wanted the order to be listed in a random format. so this is what i did, in this query i will show you.
$Query = "SELECT * FROM mytable WHERE id=23 ORDER BY RAND()";
as you can see, the query will be sorted randomly