修改留言页面:
<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语句写的不对吗?为什么提示留言更改成功了,但是实际没有改变呢?
解决方案 »
- 怎么用php修改远程文件
- php定时生成html
- 正则匹配问题
- 数据库字段格式的问题
- 使用session_is_registered,session_register,session_destroy等函數,
- 写入文本居然不换行?为什么!
- 关于mysql_connect函数的求助!!!
- 表单使用enctype="multipart/form-data"属性后,不能取得post数据。如:
- 问几个很菜的问题,麻烦大家帮忙解决!
- php 使用move_uploaded_file 函数 目标文件夹权限问题?
- 菜鸟求解?做一个手机软件下载时选择机型的设置,该怎么办?谁又会?可以支付报酬
- 抓取百度MP3歌曲链接遇到了问题
下面加一句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']的值呢?
应该怎么改啊