PHP Survey System 1_php Tutorial

Source: Internet
Author: User
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 ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.