Program Name RECORDVOTEPOLL.PHP3
Author: phpstudent
This procedure is used to record the number of votes
Interface Parameters $vpollid Survey ID, $vchioceid option ID, must have two parameters in the submission form, generally $vpollid
Require (DATABASE.PHP3); DATABASE. PHP3 is a custom database interface that masks MySQL and Oracle differences
$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
Updating data tables
$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
Here are the results of the survey
");
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,
Polltitle varchar (+) not NULL,
Polldetail varchar (+) not NULL,
PRIMARY KEY (Pollid),
UNIQUE Pollid (Pollid)
);
2.
CREATE TABLE Pollchioce (
Pollid tinyint (1) DEFAULT 0 not NULL,
Chioceid tinyint (1) DEFAULT 0 not NULL,
Chiocename varchar () not NULL,
Chiocenum Int (5) DEFAULT 0 not NULL,
Chiocecolor varchar (6) Not NULL
);
http://www.bkjia.com/PHPjc/532224.html www.bkjia.com true http://www.bkjia.com/PHPjc/532224.html techarticle / /Program name RECORDVOTEPOLL.PHP3//Author: phpstudent//The program is used to record the number of votes//interface Parameters $vpollid Survey ID, $vchioceid option ID, must have two parameters in the submission form ...