0

I have a bunch of data in an array that I want to insert into websql. To do this I have tried the following but it just crashs the browser...

  while (i != data_lines)
   {
   db.transaction(function (tx) 
   {
   tx.executeSql('INSERT INTO  ' + tablename + ' (column1 column2. column3) VALUES (?, ?, ?)',[arrData[i][0],arrData[i][1],arrData[i][2]],
   i++)
   });
   }

As well as...

   while (i != data_lines)
   {
   i++
   db.transaction(function (tx) 
   {
   tx.executeSql('INSERT INTO  ' + tablename + ' (column1 column2. column3) VALUES (?, ?, ?)',[arrData[i][0],arrData[i][1],arrData[i][2]])
   });
   }

In this example i is set to the maximum record without iterating through. What would be the best method to perform this?

1 Answer 1

1

Loop over request

db.transaction(function (tx) {
while (i != data_lines) {
     i++
       tx.executeSql('INSERT INTO  ' + tablename + ' (column1 column2. column3) VALUES (?, ?, ?)',[arrData[i][0],arrData[i][1],arrData[i][2]])
     });
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.