Skip to content

Instantly share code, notes, and snippets.

@jhaynie
Created December 1, 2008 03:38
Show Gist options
  • Save jhaynie/30609 to your computer and use it in GitHub Desktop.
Save jhaynie/30609 to your computer and use it in GitHub Desktop.
<div id="result">You should have seen a count here</div>
<script>
ti.ready(function($)
{
var db = new ti.Database
db.open("foo");
db.execute("create table if not exists Test (Phrase text, Timestamp int)");
db.execute("insert into Test values (?,?)", ["Jeff!",new Date().getTime()]);
var rs = db.execute("select count(*) from Test where Phrase like 'Jeff%'");
if (rs.isValidRow())
{
$("#result").html("number of records: "+rs.field(0));
}
rs.close();
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment