das könnte klappen:
Code:
<?
$sponsoren=db_query("SELECT * FROM ".$db_prefix."_vklicks_einst where status='1' order by sponsor");
while($row=mysql_fetch_array($sponsoren))
{
$count++;
if($count >'2'){$count ='1';}
$sql_1=mysql_fetch_array(db_query("Select COUNT(*) as menge from ".$db_prefix."_vcheck_codes where sponsor='".$row['kamp_als']."' and uid='".$_SESSION['uid']."'"));
$sql_2=mysql_fetch_array(db_query("Select SUM(betrag) as summe,COUNT(*) as menge from ".$db_prefix."_vcheck_codes where sponsor='".$row['kamp_als']."' and uid='".$_SESSION['uid']."' and status='0'"));
$erg=100-(100/$sql_1['menge']*$sql_2['menge']);
$g1=$g1+$sql_1['menge'];
$g2=$g2+$sql_2['menge'];
$g3=$g3+$sql_2['summe'];
$ges=100-(100/$g1*$g2);
}
menuehead("Vergütungs Check");?>
<?=number_format($ges,2,",",".")."%";?>
<?menuefoot();?>