I have an list of names in a mysql data that I want to sort randomly for a sporting event draw. Using the following code.
<?php
$user="";
$password="";
$database="";
mysql_connect('localhost',$user,$password);
@mysql_select_db($database) or die( "Unable to select database");
$result = mysql_query("SELECT * FROM entries ORDER BY RAND()")
or die(mysql_error());
$rows = mysql_num_rows($result);
?>
This generally works well for me however there are times where an entrant enters the event twice and even after a random sort his name appears one after the other. Should i be using a different php function? Or is it a matter of adding an if clause ?
Thanks in advance...