here is the code for getting the winners if anyone could help me sort this out.
php code
PHP Code:
if($_REQUEST['do']=="winners"){
$winner_results=$DB_site->query("SELECT t1.*,t2.username FROM ".TABLE_PREFIX."lottery_winners as t1,".TABLE_PREFIX."user as t2 WHERE t1.userid=t2.userid ORDER BY t1.id DESC");
$are_winners=$DB_site->num_rows($winner_results);
if($are_winners==0){
$winnerbits="0";
eval('$current = "' . fetch_template('lottery_winner') . '";');
}else{
$winnerbits="1";
$i=0;
$e=1;
while($winners=$DB_site->fetch_array($winner_results)){
$kleur = ($e % 2) ? $class='alt2' : $class='alt1';
$winners['place']=$winners['place']+1;
$date=$winners['date'];
if($e==1){
$prev=$date;
}
if($prev!=$date){
$datum=$prev;
eval('$morebits .= "'.fetch_template('lottery_winner_bit').'";');
$prev=$date;
$showbits="";
$i++;
}
eval('$showbits .= "' . fetch_template('lottery_winner_bit_bit') . '";');
$e++;
}
eval('$current = "'.fetch_template('lottery_winner').'";');
}
}