-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
65 lines (45 loc) · 1.28 KB
/
index.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php
ini_set("dispaly_errors", 1);
include 'Query.php';
/*
* select * from user where status = 1
* with all data
* just like this following code
*/
$query = new Query;
$query->find("user")
->where(['status' => 1])
->limit(2)
->orderBy("id desc");
$result = $query->all();
//print result
echo "<pre>";
print_r($result);
//print result single row using one()
$one = $query->one();
echo "<pre>";
print_r($one);
// looping
if ($result)
foreach ($result as $res) {
echo ' id :' . $res->id . ' username is :' . $res->username;
}
echo "<p> </p>";
// insert into
$query = new Query;
$query->find('user');
$query->name = "Andy Laser";
$query->email = '[email protected]';
$query->username = "laser";
$query->save();
echo "<pre>";
print_r($query);
echo 'my id is:' . $query->id . ' and my name is ' . $query->name . ' and table name is ' . $query->table;
$user = new Query();
$user->find('user')->where(['id' => 12])->one();
$user->username = 'testing1123232';
$user->save();
echo 'my id is:' . $query->id . ' and my name is ' . $query->name . ' and table name is ' . $query->table;
$delete = new Query();
$delete->find('user')->where(['username' => 'laser'])->one();
$delete->delete();