Search This Blog

Friday, 23 January 2015

Fetch data randomly from database in PHP.

Fetch data randomly from MySQL database is to use "ORDER BY rand() function.



Example:



$result=mysql_query("select * from tablename order by rand() limit 5");

No comments:

Post a Comment