//名称:showresult.php3
//本程序用于查看投票结果
//作者:phpstudent
//$vpollid=1; 传递参数 调查ID
require(database.php3);
$db = new database();
$db->openDefaultConnection();
$SQL="SELECT polltitle from poll where pollid=".$vpollid;
$db->openResultset($SQL);
$db->rstNext();
$vpolltitle=$db->getItem(1); //取出调查标题
$db->closeResultset();
$SQL = "SELECT chioceid,chiocename,chiocenum,chiocecolor from pollchioce where pollid=".$vpollid;
$db->openResultset($SQL);
$i=0;
$vpollData=" ";
$vpollColor="";
$voteTotal=0;
$vchiocename=split(",","1,2,3,4,5,6,7,8");
while($db->rstNext()) //取出选项的文字,计数及颜色
{ $vchiocename[$i]=$db->getItem(2);
if($i==0)
{
$vpollData=$db->getItem(3);
$vpollColor=$db->getItem(4);
}
else
{$vpollData.=",";
$vpollData.=$db->getItem(3);
$vpollColor.=",";
$vpollColor.=$db->getItem(4);
}
$voteTotal+=$db->getItem(3);
$i++;
};
$vchiocenum=split(",",$vpollData);
$vchiocecolor=split(",",$vpollColor);
$db->closeResultset();
$db->closeConnection();
if($voteTotal==0)
echo("尚未投票");
else
{echo("调查标题:
".$vpolltitle."
");
echo("
");//调用绘制3D饼图程序
echo("目前投票总数:".$voteTotal."票,其中");
for($j=0;$j{
echo("
■");
echo($vchiocename[$j]);
echo(" ");
echo($vchiocenum[$j]."票");
}
echo("");
}
?>
=================================================//名称:showpie.php3
//作者:phpstudent
//本程序用于查看投票结果
//$vpollData;$vpollColor; 传递参数投票数据串及颜色串
require(pie3d.php3); //3D饼图类,以前程序发表过,只须将后边的实现去掉
$objp = new Pie3d();
$objp->setDataArray($vpollData);
$objp->setColorArray($vpollColor);
$objp->DrawPie();
?>
http://www.bkjia.com/PHPjc/532222.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/532222.htmlTechArticle//名称:showresult.php3 //本程序用于查看投票结果 //作者:phpstudent //$vpollid=1; 传递参数 调查ID require(database.php3); $db = new database(); $db->openDefa...