how to display output from mysql in random mannerusing php -


i want display output mysql using php in random manner. default whole array displayed sequentially.

echo "<table border='1'>  </tr> <tr> <th>user id</th> <th>user </th> <th>site </th> <th>ip address</th> <th>date</th> </tr>";  while($row = mysqli_fetch_array($result))   {   echo "<tr>";  echo "<td>" . $row['userid'] . "</td>";   echo "<td>" . $row['user_name'] . "</td>";   echo "<td>" . $row['site_name'] . "</td>";   echo "<td>" . $row['ip_address'] . "</td>";   echo "<td>" . $row['date'] . "</td>";    echo "</tr>";   } echo "</table>"; 

i want output displayed randomly on each access.

i.e. row1 displayed on first access on top of output. row10 displayed on 2nd access on top of output. row13 displayed on 3rd access on top of output.

thanks suggestions , help.

you can use mysql rand() purpose:

for eg:

select * mytable order rand(); 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -