View The Retrieved Data from webSQL Database in list

View The Retrieved Data from webSQL Database in list

I want to view the database data in <li> format and actually the data are names of picture I want to view. Here's the javascript database code

  1. var createStatement = "CREATE TABLE IF NOT EXISTS batikPattern (id INTEGER PRIMARY KEY AUTOINCREMENT, originalPattern TEXT, outlinePattern TEXT)";
  2.  
  3. var selectAllStatement = "SELECT * FROM batikPattern";
  4.  
  5. var dropStatement = "DROP TABLE batikPattern";
  6.  
  7.  var db = openDatabase("BatiQu", "1.0", "Address Book", 200000);  // Open SQLite Database
  8.  
  9. var dataset;
  10.  
  11. var DataType;
  12.  
  13.  function initDatabase()  // Function Call When Page is ready.
  14.  
  15. {
  16.  
  17.     try {
  18.  
  19.         if (!window.openDatabase)  // Check browser is supported SQLite or not.
  20.  
  21.         {
  22.  
  23.             alert('Databases are not supported in this browser.');
  24.  
  25.         }
  26.  
  27.         else {
  28.  
  29.             createTable();  // If supported then call Function for create table in SQLite
  30.  
  31.         }
  32.  
  33.     }
  34.  
  35.     catch (e) {
  36.  
  37.         if (e == 2) {
  38.  
  39.             // Version number mismatch. 
  40.  
  41.             console.log("Invalid database version.");
  42.  
  43.         } else {
  44.  
  45.             console.log("Unknown error " + e + ".");
  46.  
  47.         }
  48.  
  49.         return;
  50.  
  51.     }
  52.  
  53. }
  54.  
  55. function createTable()  // Function for Create Table in SQLite.
  56.  
  57. {
  58.   db.transaction(populateDB, errorCB, successCB);
  59.    // db.transaction(function (tx) { tx.executeSql(createStatement, [], showRecords, onError); });
  60.  
  61. }
  62.  
  63.   function populateDB(tx) {
  64.    tx.executeSql('DROP TABLE IF EXISTS batikPattern');
  65.         tx.executeSql(createStatement, []);
  66.         tx.executeSql('INSERT INTO batikPattern(originalPattern,outlinePattern) VALUES ("batik1", "outlineBatik1")');
  67.         tx.executeSql('INSERT INTO batikPattern(originalPattern,outlinePattern) VALUES ("batik2", "outlineBatik2")');
  68.         tx.executeSql('INSERT INTO batikPattern(originalPattern,outlinePattern) VALUES ("batik3", "outlineBatik3")');
  69.         tx.executeSql('INSERT INTO batikPattern(originalPattern,outlinePattern) VALUES ("batik4", "outlineBatik4")');
  70.         tx.executeSql('INSERT INTO batikPattern(originalPattern,outlinePattern) VALUES ("batik5", "outlineBatik5")');
  71.         tx.executeSql('INSERT INTO batikPattern(originalPattern,outlinePattern) VALUES ("batik6", "outlineBatik6")');
  72.         tx.executeSql('INSERT INTO batikPattern(originalPattern,outlinePattern) VALUES ("batik7", "outlineBatik7")');
  73.         tx.executeSql('INSERT INTO batikPattern(originalPattern,outlinePattern) VALUES ("batik8", "outlineBatik8")');
  74.         tx.executeSql('INSERT INTO batikPattern(originalPattern,outlinePattern) VALUES ("batik9", "outlineBatik9")');
  75.         tx.executeSql('INSERT INTO batikPattern(originalPattern,outlinePattern) VALUES ("batik10", "outlineBatik10")');
  76.         tx.executeSql('INSERT INTO batikPattern(originalPattern,outlinePattern) VALUES ("batik11", "outlineBatik11")');
  77.         tx.executeSql('INSERT INTO batikPattern(originalPattern,outlinePattern) VALUES ("batik12", "outlineBatik12")');
  78.         tx.executeSql('INSERT INTO batikPattern(originalPattern,outlinePattern) VALUES ("batik13", "outlineBatik13")');
  79.         tx.executeSql('INSERT INTO batikPattern(originalPattern,outlinePattern) VALUES ("batik14", "outlineBatik14")');
  80.         tx.executeSql('INSERT INTO batikPattern(originalPattern,outlinePattern) VALUES ("batik15", "outlineBatik15")');
  81.     
  82. }
  83.  
  84.     //function will be called when an error occurred
  85.     function errorCB(err) {
  86.       //  alert("Error processing SQL: "+err.code);
  87.     }
  88.  
  89.     //function will be called when process succeed
  90.     function successCB() {
  91.      //   alert("success!");
  92.         db.transaction(queryDB,errorCB);
  93.     }
  94.  
  95.  
  96.  
  97.  function queryDB(tx){
  98.         tx.executeSql('SELECT * FROM batikPattern',[],querySuccess,errorCB);
  99.     }
  100.  
  101.  function querySuccess(tx,result){
  102.         $('#batikPic').empty();
  103.         $.each(result.rows,function(index){
  104.             var row = result.rows.item(index);
  105.             $('#batikPic').append('<li><img src="images/Real-Pattern/'+row['originalPattern']+'.jpg"/></li>');
  106.  });
  107.   $('#batikPic').listview();
  108.  
  109.     }
  110.  
  111. function onError(tx, error) // Function for Hendeling Error...
  112.  
  113. {
  114.  
  115.     alert(error.message);
  116.  
  117. }
  118.  
  119.  
  120. $(document).ready(function () // Call function when page is ready for load..
  121.  
  122. {
  123.  
  124.     initDatabase();

  125.  
  126. });
  127.  
The Bold text is where I sense the problem comes from

and the HTML section for that is 
  1. <div class="frame" id="basic">
  2. <ul class="clearfix" id="batikPic">
  3.  
  4. </ul>
  5. </div>
Anyone knows what seems to be the problem here? When I inspect the element using google chrome the error says something like "Index must be in numbers". Thanks in advance