forked from anak10thn/ignsdk-app-doc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sql.html
43 lines (42 loc) · 1.02 KB
/
sql.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="qrc:///js/jquery.js"></script>
<script type="text/javascript" src="qrc:///js/ign.js"></script>
<script>
$(document).ready(function(){
var sql = ign.sql();
/*
set driver :
sql.driver("sql_driver ex:sqlite2/sqlite3/mysql","connection")
connection :
mysql = "hostname:user:password:database";
sqlite2 or sqlite3 = "database file";
*/
var driver = sql.driver("mysql","localhost:root:n1d2r3:ignsdk");
var qry = sql.query("select * from peserta");
if(driver){
$(".json").html(qry);
var query = $.parseJSON(qry);
var html = "";
$("h1").html("Status Database Connection : "+query.status);
if(query.status){
$.each(query.content,function(data){
html += "No : "+this.no+"<br>";
html += "Nama : "+this.nama+"<br>";
html += "Alamat : "+this.alamat+"<br><hr>";
});
}
$(".data").html(html);
}
});
</script>
</head>
<body>
<h1></h1>
<h2>JSON Data</h2>
<div class="json"></div><hr>
<h2>Data</h2>
<div class="data"></div>
</body>
</html>