#1064 - 您的SQL语法有错误;

时间:2014-03-13 06:10:39

标签: mysql

#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 'a','a','a','a','a','desc')' at line 1

我的查询是

mysql_query("insert into
room_booking(name,address,type,roomNo,arrival,arrivaldate,departure,
             departuredate,identity,email,adult,children,contact,
             extraroom,laundry,parking,spa,tennis,swimming,description)         
values('$nm','$add','$typ','$roomno','$arrv','$arrivaldate',
       '$departure','$dDate','$idt','$emailid','$adul','$child',
       '$cont','$extra,'100','100','100','100','100','$desc')");

4 个答案:

答案 0 :(得分:3)

您在"'"中遗失'$extra,只是看到您的语法,这是一个简单的错误

答案 1 :(得分:2)

在$ extra附近缺少引用,请使用以下查询

mysql_query("insert into
room_booking(name,address,type,roomNo,arrival,arrivaldate,departure,
             departuredate,identity,email,adult,children,contact,
             extraroom,laundry,parking,spa,tennis,swimming,description)         
values('$nm','$add','$typ','$roomno','$arrv','$arrivaldate',
       '$departure','$dDate','$idt','$emailid','$adul','$child',
       '$cont','$extra','100','100','100','100','100','$desc')");

答案 2 :(得分:1)

你只是错过了一个引用。试试这个:

mysql_query(insert into room_booking(name,address,type,roomNo,arrival,arrivaldate,departure,departuredate,identity,email,adult,children,contact,extraroom,laundry,parking,spa,tennis,swimming,description) values('$nm','$add','$typ','$roomno','$arrv','$arrivaldate','$departure','$dDate','$idt','$emailid','$adul','$child','$cont','$extra','100','100','100','100','100','$desc')");

答案 3 :(得分:1)

在变量$ extra

上缺少引号
  mysql_query("insert into room_booking(name,address,type,roomNo,arrival,arrivaldate,departure,
              departuredate,identity,email,adult,children,contact,
              extraroom,laundry,parking,spa,tennis,swimming,description)         

             values('$nm','$add','$typ','$roomno','$arrv','$arrivaldate',
                    '$departure','$dDate','$idt','$emailid','$adul','$child',
                    '$cont','$extra','100','100','100','100','100','$desc')");