[英]Unexpected Identifier Javascript SQL
I'm trying to build a string of an sql statement using vars in javascript. 我正在尝试使用javascript中的vars建立sql语句的字符串。
I got this line code 我得到了此行代码
var sql = "'INSERT INTO UPLOADS (poleID, submitDate, poleDamaged, poleDown, wireDown, brokenFixture, brokenBulb, fullname, phonenumber, email, comments, address, city, state, zipcode, lat, lng) VALUES (" + poleID + "," + submitdate + "," + poleDamaged + "," + poleDown + "," + wireDown + "," + brokenFixture + "," + brokenBulb + "," + fullname + "," phonenumber + "," + email + "," + comments + "," + address + "," + city + "," state + "," + zipcode + "," + lat + "," + "," + lng + ")" + "'";
and my Google Chrome dev tools console is throwing this error and pointing to the line above 我的Google Chrome开发者工具控制台抛出此错误并指向上面的行
Uncaught SyntaxError: Unexpected identifier
Any reason it is throwing this error? 任何原因引发此错误? All vars are valid.
所有var均有效。
Try this. 尝试这个。 you missed + in two places and an extra comma...
您在两个地方错过了+,并加了一个逗号...
var sql = "'INSERT INTO UPLOADS (poleID, submitDate, poleDamaged, poleDown, wireDown, brokenFixture, brokenBulb, fullname, phonenumber, email, comments, address, city, state, zipcode, lat, lng) VALUES (" + poleID + "," + submitdate + "," + poleDamaged + "," + poleDown + "," + wireDown + "," + brokenFixture + "," + brokenBulb + "," + fullname + "," + phonenumber + "," + email + "," + comments + "," + address + "," + city + "," + state + "," + zipcode + "," + lat + "," + lng + ")" + "'";
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.