时间:2021-07-01 10:21:17 帮助过:3人阅读
include("conn.php");
if(!empty($_GET['id']))
{
$id=$_GET['id'];
$sql="select * from `user` where `id`='$id'";
$query=mysql_query($sql);
$result=mysql_fetch_array($query);
}
if(!empty($_POST['sub']))
{
//$id=$_GET['id'];
$title=$_POST['title'];
$content=$_POST['content'];
$id=$_POST['hid'];
$sql="update `user` set `title` = '$title', `content` = '$content' where id='$id limit 1'";
mysql_query($sql);
echo "";
}
?>
|">编辑
">删除|
if(!empty($_POST['sub']))
{
//$id=$_GET['id'];
$title=$_POST['title'];
$content=$_POST['content'];
$id=$_POST['hid'];
$sql="update `user` set `title` = '$title', `content` = '$content' where id='$id limit 1'";
mysql_query($sql);
echo "";
}
include("conn.php");
if(isset($_POST['sub'])){ // 判斷是否提交表單
$title=$_POST['title'];
$content=$_POST['content'];
$id=$_POST['hid'];
$sql="update `user` set `title` = '$title', `content` = '$content' where id='$id limit 1'";
mysql_query($sql);
echo "";
exit();
}else{ // 不是提交表單,表示是從列表頁過來
$id=$_GET['id'];
$sql="select * from `user` where `id`='$id'";
$query=mysql_query($sql);
$result=mysql_fetch_array($query);
}
?>