PHP MySql query for random record from database table

The simplest way of selecting random rows from the MySQL database is to use “ORDER BY RAND()” clause in the query.
Example:

SELECT * FROM `table` ORDER BY RAND() LIMIT 0,1;

By Keenlio, September 5, 2014

What do you think?

Leave a Reply

Your email address will not be published. Required fields are marked *


5 + two =

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>