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

PHP investigation system 1_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 17:23:351096browse

//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,


polltitle varchar(40) NOT NULL,
polldetail varchar(200) 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(20) NOT NULL,
chiocenum int(5) DEFAULT 0 NOT NULL,
chiocecolor varchar(6) NOT NULL
);

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/532224.htmlTechArticle//Program name recordvotepoll.php3 //Author: phpstudent //This program is used to record the number of votes//Interface Parameters $vpollid survey ID, $vchioceid option ID, there must be two parameters in the submission form...
Statement:
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