首頁  >  文章  >  後端開發  >  投票管理程序_PHP教程

投票管理程序_PHP教程

WBOY
WBOY原創
2016-07-21 16:02:34808瀏覽

投票管理程序

表格結構
CREATE TABLE poll(Poll_Id INT (11) not null AUTO_INCRMENT,Poll_Name char(50) ,Poll_Del INT (11) not null AUTO_INCRMENT,Poll_Name char(50) ,Poll_Del INT ( 🎜>
建立表格pollsele(Pollsele_Id INT (11) not null AUTO_INCRMENT,Pollsele_Name char(50) ,Poll_Del INT (10) DEFAULT '0' , Pollsele_poll_Id INT (10) , 1097 ))   
--------------------------------------------- ----------- ----------- ---------------------------- -------------- ----------- --
poll.php   //主程式

     $db =mysql_connect("localhost", "root","391450");
mysql_select_db("class",$db);
$sql="select poll_id,Poll_Name from poll where poll_del='1'";
@$結果 = mysql_query($sql);


      $myrow=mysql_fetch_row($result);
     echo "";
         echo "";

      echo "$myrow[1]";



       $sql="select Pollsele_Name,pollsele_poll_id from pollsele where pollsele_del='0' and pollsele_poll_id='$myrow[0]'"$a;
@$結果 = mysql_query($sql);
  echo "

";
     echo "";
   while($myrow=mysql_fetch_row($result))
   {

   echo "";

   回顯「 p>」;
  echo "
";      迴聲「」;
       echo "";     echo "";
   echo "管理";迴聲「

」;     ? >
---------------------------------------------- -------------- ------------------------
poll_input.php  //新增主題

        $db =mysql_connect("localhost", "root","391450");
mysql_select_db("class",$db);
🎜>mysql_select_db ,poll_name,poll_del";
              echo "             while($my=mysql_fetch_row($result))
   cho "";echo $my[0];echo "";
           rgb(255,255,255)'>$我的[1]";
    echo "";echo $my[2];echo "";
                      } echo "";
                   ? >


  

           if($submit2!=" 🎜> echo "
";


        echo "主題:";輸入類型=文字名稱=標題大小=30 值=''>";



      echo "";
                    回復中「」;
           {$db =mysql_connect("localhost", "root","391450") ;
mysql_select_db("class",$db);
       $sql="select poll_name from poll where poll_name='$title'"; $sql="插入民調值('','$title','')";
mysql_query($sql);
mysql_close();
echo "";  }
           if($submit1!="有效"&&$submit3!="刪除")
          cho "
";
           echo "設定主題:";
   echo "o mysql_select_db("class",$db);
$sql="從民調選擇Poll_Id";
$結果= mysql_query ($sql);
mysql_close();
while($myrow=mysql_fetch_row($result))
{ echo "$myrow[0]" ;}

   echo " 選擇>";
     echo "";
  submit3 value='刪除'>";
       回顯「」;
回顯「
」;

   🎜>           {
              if($submit1=="有效")
              "391450 ”);
mysql_select_db("class",$db);

$sql="更新投票集Poll_Del='0'";
$結果= mysql_query($sql);

  $sql="更新輪詢集Poll_Del='1' ,其中poll_id='$sele'";
$結果= mysql_query($sql);

mysql_close();
echo "";      }
    其他
    {   $db =mysql_connect("localhost", "root","391450"),mysql_connect("localhost", "root","391450"); > $sql="從poll_id='$sele' 的投票中刪除";
$結果= mysql_query($sql);
$sql="從pollsele 中刪除,其中pollsele_poll_id='$sele'" ;
mysql_query($sql);
mysql_close();
echo "";   > }
? >
---------------------------------------------- -------------- ---------------------
pollsele.php  //新增選項

        $db =mysql_connect("localhost", "root","391450");
mysql_select_db("class",$db);               echo "             @$result=mysql_query($sql);
              {

    echo "";echo "";echo $my[0];echo "";
              echo "$my[1]";
    echo "";echo $my[2];echo "";
        echo "";
                 echo "
";
                   ? >


  

           if($submit2!=" palign=center>";
echo "
";


        echo "選項>";
       echo "";



      echo "

     ='新增'>";
                    回顯「」;
    >      {$db =mysql_connect("localhost" , "root","391450");
mysql_select_db("class",$db);


$sql="插入pollsele 值('','$title','' ,'$id','')";
mysql_query($sql);
mysql_close();
echo "";  }
           if($submit1!="有效"&&$submit3!="無效")
          cho "";
            echo "設定選項:";
   echo "";
      回顯「」;            其他
           { $db =mysql_connect("localhost    if ($submit1=="有效")
      {
    $sql="update pollsele set Pollsele_Del='0' where pollsele_id='$sele'";
$result = my polls pollsele_id='$sele'";
$result = mysql_query>; {
$sql="update pollsele set Pollsele_Del='1' where pollsele_id='$sele'";
$結果= mysql_query($sql);   }
mysql_close();
echo  }
mysql_close();
echo" ";      }


?>
--------- -------------------------------------------------- - -----------------------
pollsee.php  //投票結果

       if ($toupiao!="" ){
$db =mysql_connect("localhost", "root","391450");
mysql_select_db("class",$db);
  $elesql="select Pollsele_Name,polls_ from polls where pollsele_name='$toupiao'";
@$結果= mysql_query($sql);
  $myrow=mysql_fetch_row($result);
  $poll_num=$myrow($result);
  $poll_num=$myrow[1]; =$poll_num 1;
$sql="update pollsele set Pollsele_num='$poll_num' where pollsele_name='$toupiao'";
mysql_query($sql);
 Poll_Name from poll where poll_id='$poll_id'";
@$結果= mysql_query($sql);
     $title=mysql_fetch_row($result); 🎜>      echo $title[0];迴聲「」;
      回顯「
」;
    '$poll_id'";
@$結果= mysql_query($sql);
      echo ""; 🎜>  while($myrow=mysql_fetch_row($result))
  {   echo ""; echo " 55:1px 🎜>  echo $myrow[0];echo " ";echo $myrow[1];迴聲「 ”;}迴聲「」;  }
  else
  {echo "你不能投空票!!!";}

    ?>  

【論文版權歸作者與奧索網共同擁有,如需轉載,請版權作者及出處】    

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/316512.htmlTechArticle投票管理程序表結構CREATE TABLE poll(Poll_Id INT (11) not null AUTO_INCREMENT,Poll_Poll_Id INT (11) not null AUTO_INCREMENT,Poll_Name char(50) Name char(50), Poll_Del INT (10) DEFAULT '0' , PRIMARY KEY (Poll_Id)) CREATE TABLE polls...
陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn