PHP: Error :Syntax to be user near '='a_name','='another_name' at line 1

PHP: Error :Syntax to be user near '='a_name','='another_name' at line 1

下面是我出错的代码:

 $f1=$row['ParentName'];
 $f2=$row['Full_Name'];
 $f3=$row["Address_1"];
 $f4= $row['Address_2'];
 $f5=$row['City'];
 $f6=$row['State'];
 $f7=$row['Country'];
 $f9=$row['Contact_No'];

 $sql1="UPDATE login_signup ".
                           "SET $f1=' ".$_POST["pname"]." ',$f2= ' ".$_POST["fname"]." ', $f3= ' ".$_POST["addr1"]." ',$f4= ' ".$_POST["addr2"]." ',$f5= ' ".$_POST["city"]." ', $f6= ' ".$_POST["state"]." ',$f7= ' ".$_POST["country"]." ', $f9= ' ".$_POST["cn"]." ' ".
                           "WHERE $var= ' ".$_POST["email"]." '";

错误是这样的:

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 '=' ABCD ',= ' XYZ ', = ' dfgh ',= ' ZXCV ',= '' at line 1

ABCD,XYZ,ZXCV,dfgh--分别通过全名、父母姓名....表格提交

试试这个

使用 table 的列名而不是它们的值。

$sql1="UPDATE login_signup SET ParentName='".$_POST["pname"]."' , Full_Name= '".$_POST["fname"]."' , Address_1 = '".$_POST["addr1"]."' , Address_2 = '".$_POST["addr2"]."' , City= '".$_POST["city"]."' , State = '".$_POST["state"]."' , Country = '".$_POST["country"]."' , Contact_No= '".$_POST["cn"]."' WHERE $var= '".$_POST["email"]."' ";