投票管理程序
表格結構
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 ""; 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 "
」;
🎜> {
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 "