I have a Do, While Loop and it looks like this
do {
$bh1 = rand(1,20);
$bh2 = rand(1,20);
$bh3 = rand(1,20);
}
while ($bh1 != $bh2 && $bh2 != $bh3 && $bh1 != $bh3);
mysql_query("INSERT INTO hb_lottery SET num1='$bh1', num2='$bh2', num3='$bh3'") or die(mysql_error());
Whenever I look in the database, two of the columns are always the same. But my do while loop should not allow that. I want this loop to generate 3 random numbers but none can be the same. How can I fix this to do this?