您的位置:首页网页设计PHP实例 → 投票管理程序

投票管理程序

时间:2004/11/7 3:24:00来源:本站整理作者:蓝点我要评论(0)

投票管理程序



表结构

CREATE TABLE poll(Poll_Id INT (11) not null AUTO_INCREMENT,Poll_Name char(50) ,Poll_Del INT (10) DEFAULT '0' , PRIMARY KEY (Poll_Id))   



CREATE TABLE pollsele(Pollsele_Id INT (11) not null AUTO_INCREMENT,Pollsele_Name char(50) ,Poll_Del INT (10) DEFAULT '0' , Pollsele_poll_Id INT (10) ,pollsele_num int (10), PRIMARY KEY (Pollsele_Id))   

-------------------------------------------------------------------------------------------------

poll.php   //主程序




mysql_select_db("class",$db);

$sql="select poll_id,Poll_Name from poll where poll_del='1'";

@$result = mysql_query($sql);





      $myrow=mysql_fetch_row($result);

     echo "";

         echo "";

       echo "
";



      echo "$myrow[1]";







       $sql="select Pollsele_Name,pollsele_poll_id from pollsele where pollsele_del='0' and pollsele_poll_id='$myrow[0]'";

@$result = mysql_query($sql);

  echo "
";

     echo "

";

   while($myrow=mysql_fetch_row($result))

   {



   echo "$myrow[0]";

     echo " ";                                          }

   echo "
";  echo "
";

  echo "";



   echo "

";

  echo "
";      echo "
";

   mysql_close();

    echo "
";

    echo "

";

   echo "管理"; echo "

";     ?>

-----------------------------------------------------------------------

poll_input.php  //添加主题




mysql_select_db("class",$db);

       $sql="select poll_id,poll_name,poll_del from poll";

              echo "";

             $result=mysql_query($sql);

             while($my=mysql_fetch_row($result))

            {



    echo "";echo "";

              echo "";

    echo "";

                 echo "";



                  }    echo "
";echo $my[0];echo "$my[1]";echo $my[2];echo "
";

                   ?>





  


           if($submit2!="添加")

             { echo "

";

             echo "

";





        echo "主题:";

       echo "";







      echo "";

                    echo "

";

           echo"
";   }



else

      {$db =mysql_connect("localhost", "root","391450");

mysql_select_db("class",$db);

       $sql="select poll_name from poll where poll_name='$title'";

             mysql_query($sql);





$sql="insert into poll values('','$title','')";

mysql_query($sql);

mysql_close();

echo "";  }

           if($submit1!="有效"&&$submit3!="删除")

           {  echo "

";

           echo "

";

           echo "设置主题:";

   echo "";

     echo "";

        echo "";

       echo "

";

echo "
";



           }

           else

           {

              if($submit1=="有效")

              {

           $db =mysql_connect("localhost", "root","391450");

mysql_select_db("class",$db);



$sql="update poll set Poll_Del='0'";

$result = mysql_query($sql);



  $sql="update poll set Poll_Del='1' where poll_id='$sele'";

$result = mysql_query($sql);



mysql_close();

echo "";      }

    else

    {   $db =mysql_connect("localhost", "root","391450");

mysql_select_db("class",$db);

$sql="delete from poll where poll_id='$sele'";

$result = mysql_query($sql);

$sql="delete from pollsele where pollsele_poll_id='$sele'";

mysql_query($sql);

mysql_close();

echo "";      }



}

?>

--------------------------------------------------------------------

pollsele.php  //添加选项




mysql_select_db("class",$db);

       $sql="select pollsele_id,pollsele_name,pollsele_del,pollsele_num from pollsele where pollsele_poll_id='$id'";

              echo "";

             @$result=mysql_query($sql);

             while($my=mysql_fetch_row($result))

            {



    echo "";echo "";

              echo "";

    echo "";

         echo "";

                 echo "";



                  }    echo "
";echo $my[0];echo "$my[1]";echo $my[2];echo "";echo $my[3];echo "
";

                   ?>





  


           if($submit2!="添加")

             {     echo "

";

             echo "

";





        echo "选项:";

       echo "";







      echo "";

                    echo "

";

           echo"
";   }



else

      {$db =mysql_connect("localhost", "root","391450");

mysql_select_db("class",$db);





$sql="insert into pollsele values('','$title','','$id','')";

mysql_query($sql);

mysql_close();

echo "";  }

           if($submit1!="有效"&&$submit3!="无效")

           {  echo "

";

           echo "

";

            echo "设置选项:";

   echo "";

     echo "";

        echo "";

      echo "

";

echo "
";



           }

           else

           { $db =mysql_connect("localhost", "root","391450");

mysql_select_db("class",$db);

      if ($submit1=="有效")

      {

    $sql="update pollsele set Pollsele_Del='0' where pollsele_id='$sele'";

$result = mysql_query($sql);}

else

{

$sql="update pollsele set Pollsele_Del='1' where pollsele_id='$sele'";

$result = mysql_query($sql);   }

mysql_close();

echo "";      }





?>

----------------------------------------------------------------------

pollsee.php  //投票结果




$db =mysql_connect("localhost", "root","391450");

mysql_select_db("class",$db);

  $sql="select Pollsele_Name,pollsele_num from pollsele where pollsele_name='$toupiao'";

@$result = mysql_query($sql);

  $myrow=mysql_fetch_row($result);

  $poll_num=$myrow[1];

  $poll_num=$poll_num+1;

$sql="update pollsele set Pollsele_num='$poll_num' where pollsele_name='$toupiao'";

mysql_query($sql);



    $sql="select Poll_Name from poll where poll_id='$poll_id'";

@$result = mysql_query($sql);

     $title=mysql_fetch_row($result);

       echo "

";

      echo $title[0]; echo "

";

      echo "
";

       $sql="select Pollsele_Name,pollsele_num from pollsele where pollsele_del='0' and pollsele_poll_id='$poll_id'";

@$result = mysql_query($sql);

      echo "";

  while($myrow=mysql_fetch_row($result))

  {   echo ""; echo "";} echo "
";

  echo $myrow[0];echo "
";echo $myrow[1]; echo "
";  }

  else

  {echo "你不能投空票!!!";}



    ?>  



【本文版权归作者与奥索网共同拥有,如需转载,请注明作者及出处】    


相关阅读 Windows错误代码大全 Windows错误代码查询激活windows有什么用Mac QQ和Windows QQ聊天记录怎么合并 Mac QQ和Windows QQ聊天记录Windows 10自动更新怎么关闭 如何关闭Windows 10自动更新windows 10 rs4快速预览版17017下载错误问题Win10秋季创意者更新16291更新了什么 win10 16291更新内容windows10秋季创意者更新时间 windows10秋季创意者更新内容kb3150513补丁更新了什么 Windows 10补丁kb3150513是什么

文章评论
发表评论

热门文章 没有查询到任何记录。

最新文章 我的php文件怎么打开_php运算符怎么写 php 如何生成静态页面的函数PHP生成图片缩略图PHP session常见问题集锦及解决办法PHP实现同步远程Mysql

人气排行 DEDE在文章列表文章没有缩略图的不显示图片php+mysq修改用户密码我的php文件怎么打开_如何打开php文件的办法FCKeditor的配置和使用方法使用dedecms建站教程PHP+Ajax实现分页技术图片存储与浏览一例Linux+Apache+PHP+MySQLPHP生成图片缩略图