duanbiaoshu2021 2013-07-24 09:21
浏览 21

得到此错误#1064

When I'm inserting my table empinfo

Query for Insert table

$sql="INSERT INTO empinfo(EmpName,Add,MobileNo)values('$EmpName','$Add','$MobileNo')";

I get the error:

#1064 - 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 'Add,MobileNo)values('jaimin','Baroda','123')' at line 1 
  • 写回答

2条回答 默认 最新

  • duanchi6397 2013-07-24 09:23
    关注

    Add is a reserved word within MySQL. If you want to use it as an identifier, then surround it with backticks (as you always should do with identifiers):

    $sql="INSERT INTO empinfo(`EmpName`,`Add`,`MobileNo`)values('$EmpName','$Add','$MobileNo')";
    
    评论

报告相同问题?