Note that there are some explanatory texts on larger screens.

plurals
  1. POSQLite in a webapp with jQtouch
    primarykey
    data
    text
    <p>I'm treying to create a simple todo webapp with jQtouch but I'm having some time creating a SQLite database. Or the database is created with no tables, and when I refresh Safari the database is created again, resulting in many datbases with diffrent names.</p> <pre><code>$(function() { var db; //DATABASE var shortName = 'todosDB'; var version = '1.0'; var displayName = 'todosDB'; var maxSize = 65536; db = openDatabase(shortName, version, displayName, maxSize); db.transaction( function(transaction) { transaction.executeSql( 'IF NOT EXISTS CREATE TABLE todos ' + '(id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, ' + 'todo TEXT NOT NULL, description TEXT NOT NULL' + 'date DATE);' ); } ); </code></pre> <p>And when I finally create it nothing happens when I try to put some data in the db.</p> <pre><code>db.transaction( function(transaction) { transaction.executeSql( 'INSERT INTO todos (todo, description) VALUES (' + $('#todo').val() + ', ' + $('#description').val() + ' );' ); } ); </code></pre> <p>Any help would be appreciated. I don't know if the problem is because of how jQtouch handles the initial function? It seems like the transaction does not even execute which leads me to believe there is something with the opening lines that is the problem.</p> <p>EDIT: The biggest trouble I have is duplicating databases, every time I refresh the browser it creates another database. The table are created now but since it creates a new database every time it makes a new table every time and so on.</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.
    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