php调查系统(1)
时间:2007-02-17 来源:PHP爱好者
<?php
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
//程序名 recordvotepoll.php3
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
//作者:phpstudent
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
//本程序用于记录投票数
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
//接口参数 $vpollid调查ID,$vchioceid选项ID,在提交表单中必须有着两个参数,一般$vpollid
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
require('database.php3'); //DATABASE.PHP3是屏蔽了MYSQL及ORACLE差异性的自定义数据库接口
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
$db = new database();
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
$db->openDefaultConnection();
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
$SQL = "SELECT chiocenum from pollchioce where pollid=".$vpollid." and chioceid = ".$vchioceid;
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
$db->openResultset($SQL);
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
$db->rstNext();
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
$vpolldata=$db->getItem(1);
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
$vpolldata++; //增加票数
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
//更新数据表
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
$SQL = "update pollchioce set chiocenum = ".$vpolldata." where
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
pollid=".$vpollid." and chioceid = ".$vchioceid;
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
$db->executeUpdate($SQL);
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
$db->executeUpdate("COMMIT");
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
$db->closeConnection();
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
echo("<p align=center>感谢您参与本次调查<br>以下是调查结果<br></p>");
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
include('showresult.php3'); //showresult.php3是显示结果的文件
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
?>
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
数据表的结构如下:
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
1、
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
CREATE TABLE poll (
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
pollid tinyint(1) DEFAULT '0' NOT NULL,
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
polltitle varchar(40) NOT NULL,
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
polldetail varchar(200) NOT NULL,
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
PRIMARY KEY (pollid),
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
UNIQUE pollid (pollid)
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
);
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
2、
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
CREATE TABLE pollchioce (
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
pollid tinyint(1) DEFAULT '0' NOT NULL,
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
chioceid tinyint(1) DEFAULT '0' NOT NULL,
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
chiocename varchar(20) NOT NULL,
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
chiocenum int(5) DEFAULT '0' NOT NULL,
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
chiocecolor varchar(6) NOT NULL
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
);
php爱好者站 http://www.phpfans.net php基础|php进阶|php模板.
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
//程序名 recordvotepoll.php3
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
//作者:phpstudent
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
//本程序用于记录投票数
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
//接口参数 $vpollid调查ID,$vchioceid选项ID,在提交表单中必须有着两个参数,一般$vpollid
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
require('database.php3'); //DATABASE.PHP3是屏蔽了MYSQL及ORACLE差异性的自定义数据库接口
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
$db = new database();
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
$db->openDefaultConnection();
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
$SQL = "SELECT chiocenum from pollchioce where pollid=".$vpollid." and chioceid = ".$vchioceid;
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
$db->openResultset($SQL);
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
$db->rstNext();
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
$vpolldata=$db->getItem(1);
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
$vpolldata++; //增加票数
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
//更新数据表
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
$SQL = "update pollchioce set chiocenum = ".$vpolldata." where
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
pollid=".$vpollid." and chioceid = ".$vchioceid;
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
$db->executeUpdate($SQL);
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
$db->executeUpdate("COMMIT");
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
$db->closeConnection();
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
echo("<p align=center>感谢您参与本次调查<br>以下是调查结果<br></p>");
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
include('showresult.php3'); //showresult.php3是显示结果的文件
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
?>
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
数据表的结构如下:
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
1、
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
CREATE TABLE poll (
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
pollid tinyint(1) DEFAULT '0' NOT NULL,
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
polltitle varchar(40) NOT NULL,
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
polldetail varchar(200) NOT NULL,
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
PRIMARY KEY (pollid),
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
UNIQUE pollid (pollid)
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
);
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
2、
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
CREATE TABLE pollchioce (
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
pollid tinyint(1) DEFAULT '0' NOT NULL,
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
chioceid tinyint(1) DEFAULT '0' NOT NULL,
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
chiocename varchar(20) NOT NULL,
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
chiocenum int(5) DEFAULT '0' NOT NULL,
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
chiocecolor varchar(6) NOT NULL
www.chinaitp ower .comQLmgFmgTihLT10mEsMLxi8Nwf
);
php爱好者站 http://www.phpfans.net php基础|php进阶|php模板.
相关阅读 更多 +