This tutorial would helpful in case if you want to display random records.

Please note this is a php script !

    <?php

     include_once “connecttomysql.php”;

     $sql = mysql_query(“SELECT name,email FROM person ORDER BY RAND() LIMIT 5″);

      while($row = mysql_fetch_array($sql)){

      $name = $row[“name”];
       $email = $row[“email”];

       echo “$name n”;
       echo “$email n”;

       ?>