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>";
}
这是我的代码:
$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
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
<?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>";
}
}
?>