关于投票问题

WBOY
Release: 2016-06-23 13:39:52
Original
824 people have browsed it

php大概的怎么让每人每天投N票,谢啦


回复讨论(解决方案)

在投票人名下计数,每日清空或转移

不限制用户投票次数。

??每人在?天的投票次?,?大於某值?提示,已超?投票次?。

??每人在?天的投票次?,?大於某值?提示,已超?投票次?。

就是不知道怎么记录当天的投票次数啊,能简单写个例子么

在投票人名下计数,每日清空或转移

这个活动结束时是关于每个投票选项统计票数的,最好是怎么判断当天或24小时内的票数的例子

在投票人名下计数,每日清空或转移



已经说的很清楚了,就是几个字段解决:用户名、统计总数、统计当天总数、更新时间。基本就够你用了

建议 建一个日志表 做每一次的投票数据!以后要什么数据 都可以统计!

table
id     自增id
uid   用?id
date 日期
votenum 投票次?

判?是否已超? n次,如未超?,允?投票。

$n = 10;$uid = 1;$sqlstr = "select votenum from table where uid=".$uid." and date='2015-02-06'";$result = mysql_query($sqlstr) or die(mysql_error());if(!$result){   $sqlstr = "insert into table(uid,date,votenum) values('".$uid."','".date('Y-m-d')."',1)";   mysql_query($sqlstr) or die(mysql_error());}elseif($result['votenum']>$n){    echo '今天你已投票'.$n.'次,不能再投票';    exit();}else{   $sqlstr = "update table set votenum=votenum+1 where uid=".$uid." and date='".date('Y-m-d')."'";   mysql_query($sqlstr) or die(mysql_error());}// ?行投票代?echo '投票成功';
Copy after login

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!