Created
June 28, 2010 15:57
-
-
Save bmadigan/456004 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var adp = Titanium.API.Application.getDataPath(); | |
var dbpath = adp+"\\"+"sampledb.db"; | |
var db = Titanium.Database.openFile(dbpath); | |
db.execute('CREATE TABLE IF NOT EXISTS users (id INTEGER PRIMARY KEY, firstname VARCHAR(50), lastname VARCHAR(50))'); | |
var firstname = $("input#firstname").val(); | |
var lastname = $("input#lastname").val(); | |
db.execute("INSERT INTO users (firstname, lastname) VALUES (?, ?)", firstname, lastname); | |
alert("Added the User: " + firstname + " " + lastname); | |
db.close(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment