投票的结果页面的功能是根据投票的统计数据,显示当前的投票结果。只有在登录的情况下才能查看。
1、数据库连接部分
alert('请先登录!');location.href='index.php';"; }else{ $voteid=@$_GET['vid']; if($voteid == ''){ echo "location.href='index.php';"; }else{ $sql="select vname,starttime,uid,vintro,open,more,max,min from vote where vid='".$voteid."'"; $voteitem=mysql_query($sql); $vitem=mysql_fetch_array($voteitem); $sql2="SELECT itemcount,item,num FROM votetitle where vid='".$voteid."'"; $votetitle=mysql_query($sql2); $vtitle=mysql_fetch_array($votetitle); $sql3="SELECT username FROM users where uid='".$vitem['uid']."'"; $uname=mysql_query($sql3); $username=mysql_fetch_row($uname); ?>
2、投票活动基本信息的显示
发布人: | 发布时间: |
3、逐条输出结果
".$option[$i]."". "". "票数:".$ballot[$i]." 得票率:".$rate[$i]."%
"; } ?>
(1)通过方法计算出得票率,并形成图表
for($i=0;$i4、效果
感谢大家的阅读,希望大家有所收益。
本文转自:https://blog.csdn.net/tianyao9hen/article/details/50495693
推荐教程:《PHP教程
当前文章:一小时学会简易在线投票系统(php)
链接地址:http://csruizhi.cn/article/chccog.html