";
$rw=1;
while ($db=mysql_fetch_array($result)) {
$sql1="select * from adc57 where ad_code='F' and ad_reg='$reg' and spcode='$db[sp_id]'
and nopic='' ";
$result1=mysql_query($sql1);
$picf=mysql_num_rows($result1);
$sql2="select * from adc57 where ad_code='F' and ad_reg='$reg' and spcode='$db[sp_id]'
and nopic='1' ";
$result2=mysql_query($sql2);
$nopicf=mysql_num_rows($result2);
$sql3="select * from adc57 where ad_code='Fo' and ad_reg='$reg' and spcode='$db[sp_id]'
and nopic='' ";
$result3=mysql_query($sql3);
$picfo=mysql_num_rows($result3);
$sql4="select * from adc57 where ad_code='Fo' and ad_reg='$reg' and spcode='$db[sp_id]'
and nopic='1' ";
$result4=mysql_query($sql4);
$nopicfo=mysql_num_rows($result4);
$allf=$picf+$nopicf;
$cpicf=number_format($picf,0,'.',',');
$cnopicf=number_format($nopicf,0,'.',',');
$allf=number_format($allf,0,'.',',');
$allfo=$picfo+$nopicfo;
$cpicfo=number_format($picfo,0,'.',',');
$cnopicfo=number_format($nopicfo,0,'.',',');
$allfo=number_format($allfo,0,'.',',');
$regpic=$picf+$picfo;
$regnopic=$nopicf+$nopicfo;
$allreg=$regpic+$regnopic;
if ($nopicf==0) { $cnopicf='-'; }
if ($nopicfo==0) { $cnopicfo='-'; }
if ($regnopic==0) { $regnopic='-'; }
echo "