[OFF TOPIC]
it is as possible to get 8888 again as any other number 😃 😃
[/OFF TOPIC]
don't know is there any way to say like rand(1,9999,{NOT 1,2,3})
there might be better way to do this but, hope this helps:
$b = rand(1,9999);
$q = mysql_query("SELECT id FROM table WHERE rand <= $b ORDER BY rand DESC");
$c = 0;
if(mysql_num_rows($q) != 0) {
if(mysql_result($q,0,0) == $b) { // exists
$current = $b;
for($a=1;$a<$b;$a++) {
if(mysql_result($q,$a,0) != $b) {
$a = $b+1;
// insert
$c = 1; // has been iserted
}
}
if($c == 1) { // if we have all reserved from $b to 1
$q = mysql_query("SELECT id FROM table WHERE rand > $b ORDER BY rand DESC");
/// similar loop as above
}
} else {
// insert
}
}
$q = mysql_query("SELECT id FROM table ORDER BY rand");
for($a=0;$a<1;$a++) {
$b = rand(1,9999);
$q = mysql_query("SELECT id FROM table WHERE Rnumber = $b");
if(mysql_num_rows($q) != 0) {
} else {
}
}