Note that there are some explanatory texts on larger screens.

plurals
  1. POwhy the value i increase by own i this loop while fetching the data from sqlite?
    primarykey
    data
    text
    <p>can you please suggest me why the value of i increase by own when i am fetching data from data base . Actually i am fetching data from table in phone gap .But along with i also count the number of elements in another table .while fetching the value of i increase by own and getting an error..<strong>Item index is out of range.</strong> </p> <pre><code>function getallTableData(tx) { tx.executeSql('SELECT * FROM CaseTable', [], querySuccess, errorCB); } function querySuccess(tx, result) { var len = result.rows.length; var countDoument = 0 $('#folderData').empty(); for (var i = 0; i &lt; len; i++) { alert(i) // here value is i =0 test1 = result.rows.item(i).CaseName; Test1(test1, function (result_count) { countDoument = result_count; // here it count value alert(result_count + "result_count") //alert is correct count value alert(i + "i"); //here i comes 1 why ? it should be 0 $('#folderData').append( '&lt;li class="caseRowClick" id="' + result.rows.item(i).id + '" data-rel="popup" data-position-to="window"&gt;' + '&lt;a href="#"&gt;' + '&lt;img src="img/Blue-Folder.png"&gt;' + '&lt;h2&gt;' + result.rows.item(i).CaseName + countDoument + '&lt;/h2&gt;' + '&lt;p&gt;' + result.rows.item(i).TextArea + '&lt;/p&gt;' + '&lt;p&gt;' + result.rows.item(i).CaseDate + '&lt;/p&gt;' + '&lt;/a&gt;' + '&lt;span class="ctrl togg"&gt;&lt;fieldset data-role="controlgroup" data-type="horizontal" data-mini="true" &gt;&lt;button class="edit button_design"&gt;Edit&lt;/button&gt;&lt;button class="del button_design"&gt;Delete&lt;/button&gt;&lt;/fieldset&gt;&lt;span&gt;' + '&lt;/li&gt;' ); }); $('#folderData').listview('refresh'); } } function Test1(test, callBack) { var x; db.transaction(function (tx) { $yoursql = 'SELECT * FROM "' + test + '" '; tx.executeSql($yoursql, [], function (tx, results) { x = results.rows.length + "TableName" + test; callBack(x); }); }); } </code></pre> <p>Check my comments also..!!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload