Below is the code i am using
Again:
$rand = mt_rand(100000,999999);
$sql = "select * from replogins where access_code = $rand";
$res = mysql_query($sql);
if(mysql_num_rows($res))
goto Again;
please help
You could easily replace the goto with a while loop, solving your problem AND getting rid of that goto at the same time. ;)
do {
$rand = mt_rand(100000,999999);
$sql = "select * from replogins where access_code = $rand";
$res = mysql_query($sql);
} while(mysql_num_rows($res));