//Name: showresult.php3
//This program is used to view voting results
//Author: phpstudent
//$vpollid=1; Pass parameter survey 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); //Get the survey title
$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()) //Get the text, count and color of the option
{ $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("Not yet voted");
else
{echo("Survey title:
". $vpolltitle."
");
echo("
");//Call the 3D pie chart drawing program
echo("The current total number of votes: ".$voteTotal." votes, where" );
for($j=0;$j{
echo("
■");
echo($vchiocename[$ j]);
echo(" ");
echo($vchiocenum[$j]."ticket");
}
echo("");
}
?>
============================================== =======//Name: showpie.php3
//Author: phpstudent
//This program is used to view voting results
//$vpollData;$vpollColor; Pass parameters Voting data string and color string
require(pie3d.php3); //3D pie chart class has been published in the previous program, just remove the subsequent implementation
$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//Name: showresult.php3 //This program is used to view voting results//Author: phpstudent //$ vpollid=1; Pass parameter survey ID require(database.php3); $db = new database(); $db->openDefa...