Can anyone turn this converstationinto a small php script that does what i said in the first post? I dont know where to add the database stuff and how to finish the rest of this script?
<Bill>: function random_from_array($array){
srand ((double)microtime()*1000000);
$num = rand(0,count($array)-1);
return $num;
}
<Bill>: and then use value: $array[$num]
<Bill>: and you fille the array with something like:
$k = "0";$q1[] = "";$tp = "0";
do{
$o = "0";
do{
$q1[$k] = $ho->camp_id;
$k++;
$o++;
}while($o < $ho->percentage);
$tp += $ho->percentage;
}while($ho = mysql_fetch_object($hq));
$nd = 100 - $tp;
for($i="0";$i<$nd;$i++){
$q1[$k] = "x";
$k++;
}
<Bill>: where $hq = an object with id's from the sites
<Bill>: $num = $random_from_array($q1);
<Bill>: where q1 is the array
<Bill>: and then open the site where the id is: $q1[$num]