Home > Backend Development > PHP Tutorial > PHP investigation system 2_PHP tutorial

PHP investigation system 2_PHP tutorial

WBOY
Release: 2016-07-13 17:23:39
Original
1067 people have browsed it

//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("PHP investigation system 2_PHP tutorial");//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();
?>

www.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...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template