請高手幫我看看這個程序,實現郵件的插入、刪除功能最后顯示結果?
<html><head></head><body><?phpif ($name==""){echo "請輸入您的姓名";exit;}elseif ($address==""){echo "請輸入您的地址";exit;}elseif{echo "請輸入您的電話";exit;}elseif ($content==""){echo "請輸入內容";exit;}else$conn=mysql_connect("localhost","root", "000000");if (!$conn) {echo "Unable to connect to DB: " . mysql_error();exit;}if (!mysql_select_db("mailbox")) {echo "Unable to select mailbox: " . mysql_error();exit;}$query="insert into sometable values('$name','$address','$tel','$content');$result=mysql_query($query);echo "您的郵件已經成功的加入到數據庫!";<?php$conn=mysql_connect("localhost","root","000000");mysql_select_db("mailbox");$del_id=$_GET["id"];$exec="delete from mailbox where id=$del_id";mysql_query($exec, $conn);echo "郵件刪除成功!";mysql_close($conn);?>$conn=mysql_connect("localhost","root", "000000");if (!$conn) {echo "Unable to connect to DB: " . mysql_error();exit;}if (!mysql_select_db("mailbox")) {echo "Unable to select mailbox: " . mysql_error();exit;}$sql = "SELECT * FROM sometable";$result = mysql_query($sql);if(!$result){echo "Could not successfully run query ($sql) from DB: ".mysql_error();exit;}if (mysql_num_rows($result) == 0) {echo "No rows found, nothing to print so am exiting";exit;}?><table width="100%" border="0"><tr><td width="30%">ID</td><td width="30%">名字</td><td width="19%">地址</td><td width="19%">電話</td><td width="51%">內容</td></tr><?while ($row = mysql_fetch_assoc($result)) {?><tr><td><? echo $row["id"]; ?></td><td><? echo $row["name"]; ?></td><td><? echo $row["address"]; ?></td><td><? echo $row["tel"]; ?></td><td><? echo $row["content"]; ?></td></tr><?}mysql_free_result($result);mysql_close($conn);?></table></body></html>請高手幫我完善這個程序,實現郵件的插入、刪除功能最后顯示結果。要能運行成功!O(∩_∩)O謝謝!
查看完整描述