一聚教程网:一个值得你收藏的教程网站

最新下载

热门教程

PHP + jquery ajax无刷新投票实例

时间:2014-07-04 编辑:简简单单 来源:一聚教程网

前台:

 代码如下 复制代码

   error_reporting(0);
   mysql_connect("localhost","root","root");
 mysql_select_db('bckq##!~%^#');
 mysql_query("set names gb2312");

 $sql="select dede_vote.aid,dede_vote.spec,dede_vote.votename,dede_vote.arcpic,dede_vote.info,
 dede_vote.totalcount from dede_vote where dede_vote.isenable=0";

?>




 
  php利用ajax实现无刷新投票-云博客
words" content="{dede:global.cfg_keywords/}" />

 
 


     $query=mysql_query($sql);
     $i=1;
    while($row=mysql_fetch_array($query))
    {
?>



编号:








投票人数:


投上一票:


 

代码:

 代码如下 复制代码

error_reporting(0);
   mysql_connect("localhost","root","root");
 mysql_select_db('bckq##!~%^#');
 mysql_query("set names gb2312");

$aid=$_POST["pollid"];

$totalcount=$_POST["totalcount"];

    $sql= "update dede_vote set totalcount='$totalcount'+1 where aid='$aid'";

     mysql_query($sql) or die(mysql_error());
   $sql1= "select totalcount from dede_vote  where aid='$aid'";  

   $query=mysql_query($sql1);

   while($row=mysql_fetch_assoc($query))

   {

    echo $row['totalcount'];
   }             

?>

热门栏目