Name: SHOWRESULT.PHP3
This program is used to view poll results
Author: phpstudent
$vpollid = 1; Pass-through 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); Remove 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 ())//Remove options for text, count and color
{$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 Draw 3D Pie chart Program
Echo ("Current poll total:". $voteTotal. " Votes, of which ");
for ($j =0; $j < $i; $j + +)
{
Echo ("");
Echo ($vchiocename [$j]);
Echo ("");
Echo ($vchiocenum [$j]. " Ticket ");
}
Echo ("");
}
?>
================================================= Name: SHOWPIE.PHP3
Author: phpstudent
This program is used to view poll results
$vpollData; $vpollColor; Pass parameter voting data string and color string
Require (PIE3D.PHP3); 3D pie chart class, the previous program has been published, only need to remove the implementation behind
$OBJP = new Pie3d ();
$OBJP->setdataarray ($vpollData);
$OBJP->setcolorarray ($vpollColor);
$OBJP->drawpie ();
?>
http://www.bkjia.com/PHPjc/532222.html www.bkjia.com true http://www.bkjia.com/PHPjc/532222.html techarticle //Name: SHOWRESULT.PHP3//This program is used to view poll results//Author: phpstudent//$vpollid = 1; pass-through parameter survey ID require (DATABASE.PHP3); $db = new Database (); $db->opendefa ...