$con = mysql_connect("localhost", "user", "password");
if (!$con)
die (mysql_error());
if ( ! mysql_select_db("database name", $con))
die (mysql_error());
// select 10 random records (can be 5 or 100)
$sql = mysql_query('SELECT * FROM table ORDER BY RAND() LIMIT 10', $con);
if ( ! $sql ) die(mysql_error());
while($row = mysql_fetch_assoc($sql))
{
echo $row['first_name'] . "<br>";
}