如何更正此查询

时间:2019-04-19 05:09:09

标签: php mysqli

总是出错

我尝试将变量放在引号中,将假名放在引号中,但仍然出错

"UPDATE employee_info
        SET NAME=$Name, ADDRESS=$Address, EMAIL=$Email, CELL_NO=$Cell_no, CNIC=$Cnic, DESIGNATION=$Designation, BASIC_PAY=$Basic_pay, BONOUS=$Bonous, TOTAL_PAY=$Basic_pay+$Bonous
        WHERE ID=$ID"))

更新的行

1 个答案:

答案 0 :(得分:-1)

换行包含引号之类的文本-

"UPDATE employee_info SET NAME='$Name', ADDRESS='$Address', EMAIL='$Email', CELL_NO=$Cell_no, CNIC=$Cnic, DESIGNATION=$Designation, BASIC_PAY=$Basic_pay, BONOUS=$Bonous, TOTAL_PAY=$Basic_pay+$Bonous WHERE ID=$ID"  

如果还有更多包含文本的字段,则也将它们包裹起来。