2014-03-13 134 views
1
#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 

我的查詢是#1064 - 您的SQL語法錯誤;

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')"); 
+0

有人可以提出一個解決方案嗎? –

+1

'...... t','$ extra,'100','1 ...'< - 注意'$ extra'後缺少''''。儘管如此,你應該_really_閱讀SQL注入和不推薦使用的'mysql_ *'API。 –

+1

謝謝Joachim Isaksson ... –

回答

3

你缺少在'$extra"'",這是一個簡單的錯誤只看到你的語法

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')"); 
2

缺失報價接近「$多餘的,使用下面的查詢

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')"); 
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')");