0
我得到SQL處理錯誤sql:underfined here.Here我檢查登錄表單是否與數據庫匹配,稱爲學生,如果有匹配,然後彈出一個警告彈出歡迎消息和轉移到下一頁。我如何修復代碼?用戶登錄使用科爾多瓦
document.addEventListener("deviceready", onDeviceReady, false);
var db;
function onDeviceReady() {
db = window.openDatabase("Database", "1.0", "Student",2*1024*1024);
db.transaction(createDB, errorCB, successCB);
}
function loginForm(){
db.transaction(checkDB, errorCB);
$.mobile.changePage("#page5",{reverse:false,transition:"slide"});
return false;
}
function checkDB(tx){
var _matric=$("[name='matric']").val();
var _password=$("[name='password']").val();
var sql ='select * from STUDENT where matric='+_matric+' and password='+_password+'';
tx.executeSql(sql,[],successLoginDB,errorCB);
}
function successLoginDB(tx,results){
var len = results.rows.length;
var _name =$("[name='name']").val();
if (len==1) {alert("Welcome "+_name);}
}
這是我的開始代碼,但我仍然收到錯誤 – user2947488