eclipse - inserting data using variables in sqlite db -
hey i'am making first phonegap application , have faced problem in sqlite db , have had code create table in database , read need insert variable value in db instead of static value , here's code insert :
tx.executesql('insert bus_stations (station_name,station_description,station_lat,station_long) values ("6th october","", + "111" + ,"31.963522")');
that works doesn't work , can ??!
var x=111; tx.executesql('insert bus_stations (station_name,station_description,station_lat,station_long) values ("6th october","", x ,"31.963522")');
by placing insert single qoutes '
making everthing inside simple string or text. x inthere becomes nothing letter x. suggest split insert string , add variable in follows:
var x = 111; tx.executesql('insert bus_stations station_name,station_description,station_lat,station_long) values ("6th october","",' + x + ',"31.963522")');
notice ' + x + '
where, before, had x
.
Comments
Post a Comment