• Howdy! Welcome to our community of more than 130.000 members devoted to web hosting. This is a great place to get special offers from web hosts and post your own requests or ads. To start posting sign up here. Cheers! /Peo, FreeWebSpace.net
managed wordpress hosting

Problem: PHP!!!!!!

Myth_Pharoah

New Member
This script for some reason does not produce the necessary results. I have a member_id_inf.dat file which has this stuff:
0
1
4
7

What I want is that any number present in that file aren't created again. So that in the random numbers all except 0,1,4 and 7 should appear at the bottom. But it is necessary that the numbers must be from that file.

This is the code:

// Random mem_id maker.
// This system makes sure that the same mem_id hasn't been already benn created.
mt_srand((double)microtime()*1000000);
$action=0;
$id_array=file("mem_id_inf.dat");
while($action==0){
$num2=mt_rand (0, 10); //2147483600
for($i=0;$i==$i;$i++) {
if ($id_array[$i] == '') {
$action=1;
break;
} else {
if ($num2 == $id_array[$i]) {
$action=0;
break;
} else {
$action=1;
continue;
}
if ($action==0) {
break;
} else {
continue;
}
}
}
}

echo "<center>:: $num2 ::</center>";


It works perfectly except for the thing that it even shows the numbers I don't want. :( CAn any one help?
 
Back
Top