If you have a counter or id field in your table which is unique, you can do this easily.
<?php
$connection=mysql_connect($dbhost,$dbuser,$dbpass);
mysql_select_db($dbname);
$query="select * from tablename";
$result=mysql_query($query);
$max=mysql_num_rows($result);//count the total records in the table
$random_members=array();
while(count($random_members) <= 5){ // until 5 members are selected
$random=rand(1,$max);//generate random number
if(! in_array($random,$random_members)){ //if random number is not in the array, add it.
$random_members[]=$random;
}
}
print_r($random_members); //print random numbers
?>
Thats it.. Cheers.. :)