$sql="update notebook set id='$id',username='$name',date='$date',content='$content'";如果保证登陆数据库没问题的话,这一句试改成这样看看

解决方案 »

  1.   

    哦,对了,update的时候,记录加上where 条件,不然的话,会一整个库都改了
      

  2.   

    楼主echo $id
    echo $name什么的看看.变量里有没有内容在
      

  3.   

    没有任何显示,为什么我的插入,删除都是好的呢,就更新就不行了。
    我是在$sql="update notebook set id=$id,username=$name,date=$date,content=$content";之前加的
    echo $id;
    echo $name;
      

  4.   

    这是调用该文件的文件:
    if($id!="")
    {
    $connect=mysql_connect("localhost","root","");
    mysql_select_db("notebook",$connect);
    $query="select * from notebook where id='$id'";
      $result=mysql_query($query);
      @mysql_data_seek($result,0);
      $data=@mysql_fetch_array($result);
      $name=$data[username];
      $date=$data[date];
      $content=$data[content];
      mysql_close($connect);
    }
    ?>
    <html>
    <head>
    <title>add information</title>
    <script language="javascript">
    <!--
    function validateform()
    {
    if(document.notebook.name.value=="")
    {
    window.alert("please input your name!");
    return false;
    }
    if(document.notebook.content.value=="")
    {
    window.alert("please input your content");
    return false;
    }
    }
    //-->
    </script>
    </head>
    <body>
    <form name="notebook" action="updatenotebook.php?id=<?php echo "$id";?>
    method="post" onsubmit="return validateform(this.form)">
    name:<input name="name" size="30" maxlength=15 value=<?echo "$name";?>><br>
    date:<input name="date" size="30" maxlength=15 value=<?echo "$date";?>><br>
    <textarea name="content" rows="12" cols="51"><?echo "$content";?></textarea><br>
    <input type="submit" value="submit information">
    </form>
    </body>
    </html>
      

  5.   

    echo "id = [$id]"; // 在这里检查$id的值,若$id无值则不会进入下面的程序段的
    if($id!="")
    {
    $connect=mysql_connect("localhost","root","");
    mysql_select_db("notebook",$connect);
    $query="select * from notebook where id='$id'";
      .....
      

  6.   

    在editnotebook.php可以显示id值,updatenotebook.php不显示
      

  7.   

    那你是通过什么方法把id传递到updatenotebook.php中去的呢,是通过那个文件的,那条语句
      

  8.   

    <form name="notebook" action="updatenotebook.php?id=<?php echo "$id";?>
    method="post" onsubmit="return validateform(this.form)">
    我想应该是这条吧?
      

  9.   


    $id=$_GET["id"];
    $name=$_POST["name"];
    $date=$_POST["date"];
    $content=$_POST["content"];
    来取值
      

  10.   

    我知道我错在那里了,我在编程的中间把register_globals =off,今天早上来上班的时候发现好了,其实只要在修改了register_globals 后,一定要重起一次机器