In my effort to learn more about WebSQL, I've ran across an "Errorundifined" in my javascript code. I've tested the code and can't seem to find the error. However, The database "To Do" gets created but not the table "Tasks". Can someone help!
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
<script type="text/javascript" src="../js/jquery.js"></script>
<script>
var db = null;
var db = openDatabase('To Do', '1.0', 'To Do', 2 * 1024 * 1024);
db.transaction(function(tx) {
tx.executeSql('CREATE TABLE IF NOT EXISTS tasks (id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, create unique, name, description, due DATETIME)');
});
$('document').ready(function() {
var db = openDatabase('To Do', '1.0', 'To Do', 2 * 1024 * 1024);
db.transaction(function(tx) {
tx.executeSql('SELECT * FROM tasks', [], querySuccess, errorCB);
});
function querySuccess(tx, results) {
var len = results.rows.length;
if(len > 0) {
}else{
alert("You Have No Tasks");
}
}
function errorCB(err) {
alert("Error" + err.code);
}
});
</script>
</head>
<body>
<h1>Hello World!</h1>
</body>
</html>