<?
$sql="select * from ref_position where position_id between '01' and '04' order by position_id DESC";
$qq=mysql_query($sql,$condb);
$sums=0;$sum=0;$spa=0;
while($row=mysql_fetch_array($qq))
{ $au=0;$bc=0;$pb=0;$ms=0;$pba=0;$dhp=0;$ch=0;$pa=0;
$sql="select citizen_id,stf_fname,stf_lname from staff where substafftype_id='1' and position_id='$row[0]' ";
$qqo=mysql_query($sql,$condb);
while($row1=mysql_fetch_array($qqo))
{
$sql="select max(grad_lev_id) from seducation where citizen_id='$row1[0]'";
$qqs=mysql_query($sql,$condb);
$rows=mysql_fetch_array($qqs);
if($rows[0]=='80'){$dhp++;}if($rows[0]=='70'){$pba++;}if($rows[0]=='60'){$ms++;}
if($rows[0]=='50'){$pb++;}if($rows[0]=='40'){$bc++;}if($rows[0]=='35'){$au++;}
if($rows[0]=='30'){$pa++;}if($rows[0]=='00'){$ch++;}
mysql_free_result($qqs);
}mysql_free_result($qqo);
$sum=$au+$bc+$pb+$ms+$pba+$dhp+$ch+$pa;
$spa=$spa+$pa;$sch=$sch+$ch;$sau=$sau+$au;
$sbc=$sbc+$bc;$spb=$spb+$pb;$sms=$sms+$ms;
$spba=$spba+$pba;$sdhp=$sdhp+$dhp;
$sums=$sums+$sum;
?>