SQL更新语句有错误,要怎么修改,我运行了之后提示是:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1' at line 1
这是我的代码:
$update=mysql_query("update tb_user set xz='$xz',ah='$ah',address='$address',phone='$phone',year='$year',month='$month',day='$day',email='$email',QQ='$QQ' where username='".$_SESSION['username']."'",$conn);
if(mysql_query($update)){
    echo "<script>alert('修改成功!');window.location.href='indivinfo.php';</script>";
}
    
else
{
    echo "<center>".mysql_error()."</center><br>";
}

解决方案 »

  1.   

    在query 之前 echo 下 "update tb_user set xz='$xz',ah='$ah',address='$address',phone='$phone',year='$year',month='$month',day='$day',email='$email',QQ='$QQ' where username='".$_SESSION['username']."'"贴出你的结果
      

  2.   

    我  echo"$update";输出的是
    1
    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1' at line 1就只输出  1
      

  3.   

    不是叫你echo $update.是叫你echo 出那句 SQL.
      

  4.   

    我这一页上的语句只有这些
    <?php include("conn.php");
     if($_POST["Submit"]=="修改资料!!" ){
     $xz=$_POST[constellation];
     $ah=$_POST[ah];
     $address=$_POST[address];
     $phone=$_POST[phone];
     $year=$_POST[year];
     $month=$_POST[month];
     $day=$_POST[day];
     $email=$_POST[email];
     $QQ=$_POST[QQ];
    $update=mysql_query("update tb_user set xz='".$xz."',ah='".$ah."',address='".$address."',phone='".$phone."',year='".$year."',month='".$month."',day='".$day."',email='".$email."',QQ='".$QQ."' where username='".$_SESSION['username']."'",$conn);echo"$update";
    if(mysql_query($update)){
        echo "<script>alert('修改成功!');window.location.href='indivinfo.php';</script>";
    }
        
    else
    {
        echo "<center>".mysql_error()."</center><br>";
    }
    }
    ?>
      

  5.   

    是叫你贴出sql语句,看下拼出来的sql语句是否有错误!
      

  6.   

    打印出sql语句,在数据库里执行下,看错在哪里了