$query=@mysql_query(select * from sondaje where activ=1 and terminat=0 limit 0,1);
if (@mysql_num_rows($query)!=0){ ?>
if (empty($_SESSION[votat])){
?>
} else {
echo
;
$row=@mysql_fetch_array($query);
echo $row[intrebare]
;
$qo=@mysql_query(select * from optiuni where idsondaj=$row[id]);
$qn=@mysql_query(select count(*) as nr from voturi where idoptiune in (select id from optiuni where idsondaj=$row[id]));
$rn=@mysql_fetch_array($qn);
$rezultate=$rn[nr];
echo Voturi: $rezultate
;
while ($ro=@mysql_fetch_array($qo)){
$qv=@mysql_query(select count(*) as nr from voturi where idoptiune=$ro[id]);
$rv=@mysql_fetch_array($qv);
$voturi=$rv[nr];
$procent=$voturi/$rezultate*100;
$procent=number_format($procent, 2, ., );
$pr1=100-$procent;
echo $ro[optiune] – $procent% / $voturi voturi.
;
echo
;
}
echo Multumim pentru vot
;
}
}
?>