//Program name recordvotepoll.php3
//Author: phpstudent
//This program is used to record the number of votes
//Interface parameters $vpollid survey ID, $vchioceid option ID, in the submission form There must be two parameters, generally $vpollid
require(database.php3); //DATABASE.PHP3 is a custom database interface that shields the differences between MYSQL and ORACLE
$db = new database();
$db->openDefaultConnection();
$SQL = "SELECT chiocenum from pollchioce where pollid=".$vpollid." and chioceid = ".$vchioceid;
$db->openResultset($SQL);
$db->rstNext();
$vpolldata=$db->getItem(1);
$vpolldata++; //Increase the number of votes
/ /Update data table
$SQL = "update pollchioce set chiocenum = ".$vpolldata." where
pollid=".$vpollid." and chioceid = ".$vchioceid;
$db->executeUpdate ($SQL);
$db->executeUpdate("COMMIT");
$db->closeConnection();
echo("
Thank you for participating in this survey
The following are the survey results
");
include(showresult.php3); //showresult.php3 is the file that displays the results
?>
The structure of the data table is as follows :
1,
CREATE TABLE poll (
pollid tinyint(1) DEFAULT 0 NOT NULL,