-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsqlite.php
48 lines (42 loc) · 970 Bytes
/
sqlite.php
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
44
45
46
47
48
<?php
class MyDB extends SQLite3
{
function __construct()
{
$this->open('flomo.db');
}
}
function find_sql($qq){
$db = new MyDB();
$sql = "select * from flomoapi";
$ret = $db->query($sql);
$n=0;
while($chen= $ret->fetchArray(SQLITE3_ASSOC) ){
if($chen['qq']==$qq){return $chen['flomoapi'];$n=1;}
}
if($n=='0'){return 'ccnull';};
$db->close();
}
function up_sql($qq,$flomoapi){
$db = new MyDB();
$sql = "UPDATE flomoapi SET flomoapi='{$flomoapi}' WHERE qq='{$qq}';";
$ret = $db->exec($sql);
$db->close();
return $ret;
}
function in_sql($qq,$flomoapi){
$db = new MyDB();
$sql = "insert into flomoapi values('{$qq}','{$flomoapi}');";
$ret = $db->exec($sql);
$db->close();
return $ret;
}
function set_sql($qq){
$flomoapi='null';
in_sql($qq,$flomoapi);
}
function del_sql($qq){
$flomoapi='null';
up_sql($qq,$flomoapi);
}
?>