修改留言页面:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>用户编辑留言页面</title>
</head>
<body>
<form name="form1" method="post" action="edit_message.php?id=">
<p>标题
<input name="mesti" type="text" size="30" value={$title}>
</p>
<p>内容:</p>
<p><textarea name="mescon" cols="30" rows="10" >{$content}</textarea>
</p>
<p>
<input type="submit" value="确定" >
<input type="reset" value="取消" >
</p>
<p> </p>
<a href="message.php">返回我的留言</a>
</form>
</body>
</html>edit_message.php:<?php
include_once('conn.php');
$link=connectDB();
$mesti=$_POST['mesti'];
$mescon=$_POST['mescon'];
$query="update notepad SET title='".$mesti."',content='".$mescon."' where id='".$_GET['id']."'";
$result=mysql_query($query,$link)or die($query.mysql_error());
if($result){
echo "<script language=\"javascript\">
alert(\"更改成功\");
window.location=\"message.php\"
</script>";
}
?>是UPDATE语句写的不对吗?为什么提示留言更改成功了,但是实际没有改变呢?
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>用户编辑留言页面</title>
</head>
<body>
<form name="form1" method="post" action="edit_message.php?id=">
<p>标题
<input name="mesti" type="text" size="30" value={$title}>
</p>
<p>内容:</p>
<p><textarea name="mescon" cols="30" rows="10" >{$content}</textarea>
</p>
<p>
<input type="submit" value="确定" >
<input type="reset" value="取消" >
</p>
<p> </p>
<a href="message.php">返回我的留言</a>
</form>
</body>
</html>edit_message.php:<?php
include_once('conn.php');
$link=connectDB();
$mesti=$_POST['mesti'];
$mescon=$_POST['mescon'];
$query="update notepad SET title='".$mesti."',content='".$mescon."' where id='".$_GET['id']."'";
$result=mysql_query($query,$link)or die($query.mysql_error());
if($result){
echo "<script language=\"javascript\">
alert(\"更改成功\");
window.location=\"message.php\"
</script>";
}
?>是UPDATE语句写的不对吗?为什么提示留言更改成功了,但是实际没有改变呢?
下面加一句echo $query ;
看看这句更新语句是否对 是否全。
兄弟你可以看下我另一个帖子http://topic.csdn.net/u/20110217/18/e4b0906e-6441-436b-a168-00616592fc25.html
为什么删除的话可以这样写$query="delete from notepad where id='".$_GET['id']."'";
UPDATE就获取不到$_GET['id']的值呢?
应该怎么改啊