jquery - SQLite Phonegap: Query on Loop error -


I am trying to query for a loop from a certain array. But it only saves the first element of the array. I looked at the console (.) (1) It is refunding 1 out of every 1 for execution. Define (['required'], function (requirement) {"strict use"; var backbone = is required ('backbone'); returnbackback view.example ({ Render: Function () {$ ('# content'). Fadeaut (200, function) ($ (this). Load ('idea / sync .html', function () {$ (this). ''; [['L12', 'Ballan', 'Kalinga', 'Mountainousus',' Third ', 54269, 12082, 0.22, 143201000], [' L8 ',' Aguinaldo ',' Iffuo ',' Hill ',' 2 ', 53805, 18,610, 0.35, 142, 708,000], [' L7 ',' ALFONSO ',' LISTA ',' Eiffuo ',' Pahari ',' 3 ', 347 46, 28,410, 0.82, 142, 707,000], ['L11', 'ASIPULO', 'Eiffuo', 'Hill', '5th', 18,287, 14,403, 0.79, 142, 711,000], ['L1', 'Bana' '' 17, '' Tobacco City '', 'Kalinga', 'Mountainous', 70025, 103912, 1.48, 'Eiffhuo', 'Mountainous', '4th', 192020, 22365, 1.17, 1427010 00] 143213000] ['L 9', 'Hingyon', 'Ifugao', 'Mountainous',' 5th ', 6202, 9795, 1.58, 142, 709,000], [' L2 ',' HUNGDUAN ',' IFGUO ',' HILL ['L3', 'Kiangan', 'Ifugao', 'Hill', '4', 20000, 15837, 0.79, 142, 703,000], '' 4 ', 26030, 9933, 0.38, 142, 702,000], [' L4 ' , 'LAGAWE', 'IFGUO', 'Pahari', '4', 20,891, 18077, 0.87, 142, 704,000], ['L5', 'Lyout', 'IfuGao', 'Mountainous', '4', 159 65, 23088, 1.4 5, 142705000], ['L13', 'Lublin', 'Kalgi', 'Mountainous', '4th', 23420, 9369, 0.4, 143206,000], ['L6', 'MAYOYAO', 'EFUGOO' 'Mouzntainous', '4', 23805, 16, 413, 0.69, 142, 706,000], ['L14', 'PASIL', 'Kalinga', 'Mountain', '5th', 1800 00, 9626, 0.51, 143208000] ['L15', 'PINUKPUK', 'Kalinga', 'Hill', '1', 74,356, 29596, 0.4, 143, 209,000], ['L16', 'Rizal', 'Kalinga', 'Hill', '4 '' L '18', 'Tanudan', 'Kalinga', 'Mountainous',' 4th ', 30755, 8529,' 23, 100, 15, 942, 0.69, 'Lail', 'Kalinga', 'Mountain', 143211000] 0.28, 143214000], '4,', 28300, 12557, 0.44, 143215000], ['L10', 'TINOC', 'Ifugao', 'Mountainous', '4th', 237070, 14147, 0.59 , 142710000]]; Var db = window. SqlitePlugin.openDatabase ("weather-app-appropriate", "1.0", 'demo', 65536); For (var i = 0; i

As you can see only one thing that is my database location is the first index of the array. nothing.

Any help?

I think the problem is that 'tx' data is not being passed in your function I will try something like this:

Change it:

 For  (var i = 0; i  

From:

  db.transaction (function (tx) {for (var i = 0; i & lt; preMadeLoc.length; i + +) {Tx.executeSql ('id, name, province, topography, classification, land_reary, population, population density, code) values ​​(?,?,?,?,?,?,?,?,?)', Insert [i]); }});  

This uses the ability of transaction to handle multiple SQL statements and ensures that the tx variable is accessible.


Comments