opendefaultconnection();
$sql = select chiocenum from pollchioce where pollid=.$vpollid. and chioceid = .$vchioceid;
$db->openresultset($sql);
$db->rstnext();
$vpolldata=$db->getitem(1);
$vpolldata++; //增加票数
//更新数据表
$sql = update pollchioce set chiocenum = .$vpolldata. where
pollid=.$vpollid. and chioceid = .$vchioceid;
$db->executeupdate($sql);
$db->executeupdate(commit);
$db->closeconnection();
echo(
感谢您参与本次调查
以下是调查结果
);
include(showresult.php3); //showresult.php3是显示结果的文件
?>
数据表的结构如下:
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
);
http://www.bkjia.com/phpjc/532224.htmlwww.bkjia.comtruehttp://www.bkjia.com/phpjc/532224.htmltecharticle//程序名 recordvotepoll.php3 //作者:phpstudent //本程序用于记录投票数 //接口参数 $vpollid调查id,$vchioceid选项id,在提交表单中必须有着两个参数...