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

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -