PHP SQL Random
The PHP SQL Random is used to fetch data randomly from database in PHP. The Rand ( ) clause is used to fetch the random data from table into the browser.
Understand with Example
The Tutorial illustrate an example from PHP SQL Random. To understand and elaborate the example we have a table 'users' that show the records of table 'users'.
Table: users
Source Code of sql_random.php
This example show you to fetch random data from database table. In this example we create select statement with ORDER BY RAND() clause in PHP. The RAND( ) clause is used to fetch data from table randomly.
<?php
|
when we refresh the browser, it randomly fetched the data from the table and display on the browser.
Output: