0
我試圖插入數據到websql中。我正在Chrome上進行測試,但無法正常工作。我得到error processing: SQL undefined
。phonegap/cordova上的websql錯誤
下面是代碼:
$(document).ready(function() {
var db = window.openDatabase("Database", "1.0", "News", 200000);
db.transaction(populateDB, errorCB, successCB);
//create table and insert some record
function populateDB(tx)
{
tx.executeSql('CREATE TABLE IF NOT EXISTS news (id INTEGER PRIMARY KEY AUTOINCREMENT, title TEXT NOT NULL, description TEXT NOT NULL,link TEXT NOT NULL,category INT)');
tx.executeSql('INSERT INTO news (title,descriptionlink,category) VALUES (?,?,?,?)',["test1","descrip","link2",2]);
}
// Transaction error callback
//
function errorCB(tx, err) {
alert("Error processing SQL: "+err);
}
// Transaction success callback
//
function successCB() {
alert("success!");
}});
感謝它的工作現在 –
好知道.. PLZ標記答案接受時,其可能爲你。 – Purus