tx.executeSql('INSERT INTO bus_stations (station_name,station_description,station_lat,station_long) VALUES ("6th October","", + "111" + ,"31.963522")');
有效,但这不起作用,我该怎么办?!
var x=111;
tx.executeSql('INSERT INTO bus_stations (station_name,station_description,station_lat,station_long) VALUES ("6th October","", x ,"31.963522")');
答案 0 :(得分:0)
将INSERT放入单个qoutes '
中,您实际上是在简单的字符串或文本中进行翻转。你的x inhere也变成了字母x。我建议您拆分INSERT字符串并按如下方式添加变量:
var x = 111;
tx.executeSql('INSERT INTO bus_stations station_name,station_description,station_lat,station_long) VALUES ("6th October","",' + x + ',"31.963522")');
请注意' + x + '
之前,您有x
。