Minggu, 28 September 2014

[SQL] Script di Dalam Index (db harus di dalam asset, nggak masuk www)

$("#Hal1").click(function(){
var now_id = $(this).attr('id');
var EF=now_id.replace('Hal', '')
var DE=Number(EF);
var db = window.sqlitePlugin.openDatabase("tes", "1.0", "Hadist", 1000000);
db.transaction(openData,errorCB);
function openData(tx) {
tx.executeSql("SELECT * FROM muslimah where id="+DE, [], querySuccess, errorCB);
}
})


function errorCB(err) {
alert("Error processing SQL: "+err.code);
}
function querySuccess(tx, results) {
$("#tui").text("")
var len = results.rows.length;
var list = $("");
for (var i=0; i<len; i++)
{
$("#tui").append("<p>"+results.rows.item(i).isi+"</p>");
}
}

Tidak ada komentar:

Posting Komentar