修改留言页面:
<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>&nbsp;  </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语句写的不对吗?为什么提示留言更改成功了,但是实际没有改变呢?

解决方案 »

  1.   

    确认where后面那个条件是否存在。
      

  2.   

    嗯,楼主可以单独echo出$_GET['id']的值看看!
      

  3.   

    $query="update notepad SET title='".$mesti."',content='".$mescon."' where id='".$_GET['id']."'";
    下面加一句echo $query ;
    看看这句更新语句是否对 是否全。
      

  4.   

    确实是$_GET['id']的值没有获取到。。
    兄弟你可以看下我另一个帖子http://topic.csdn.net/u/20110217/18/e4b0906e-6441-436b-a168-00616592fc25.html
    为什么删除的话可以这样写$query="delete from notepad where id='".$_GET['id']."'";
    UPDATE就获取不到$_GET['id']的值呢?
      

  5.   

    id 不是 int 型吗?怎么需要分号呢?$query="update notepad SET title='".$mesti."',content='".$mescon."' where id=".$_GET['id'];
      

  6.   

    action="edit_message.php?id=他的id是没有值的 
      

  7.   

    <form name="form1" method="post" action="edit_message.php?id=">看好了 id= 后面没有赋值呀!!!
      

  8.   

    我想改为action="edit_message.php?id=$_GET['id'],可那是HTML页面啊,不能这样写
    应该怎么改啊
      

  9.   

    edit_message.php?id=<?php echo $_GET['id'];?>
      

  10.   

    $query="update notepad SET title='".$mesti."',content='".$mescon."' where id='".$_GET['id']."'";where id=后面的单引号和[]里面的单引号冲突,可以把[]里面的单引号去掉,即$query="update notepad SET title='".$mesti."',content='".$mescon."' where id='".$_GET[id]."'";或者加\符号,即$query="update notepad SET title='".$mesti."',content='".$mescon."' where id='".$_GET[\'id\']."'";
      

  11.   

    你的form表单的提交方式是post