-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwhere.php
More file actions
42 lines (42 loc) · 1.18 KB
/
Copy pathwhere.php
File metadata and controls
42 lines (42 loc) · 1.18 KB
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
<?php
namespace pLinq;
class Where {
public $Other;
public $Conditions;
public function select($fields) {
return new \pLinq\Select($this, $fields);
}
public function groupBy($fields) {
$group = new \pLinq\Group();
$group->Other = $this;
$group->Fields = $fields;
return $group;
}
public function limit($numberOfRows, $offset = 0) {
$limit = new \pLinq\Limit();
$limit->Offset = $offset;
$limit->Rows = $numberOfRows;
$limit->Other = $this;
return $limit;
}
public function orderBy($fields) {
$order = new \pLinq\Order();
$order->Fields = $fields;
$order->Other = $this;
return $order;
}
public function update($data) {
$class = \pLinq\Select::GetFirstTable($this);
global $dal;
$db = $dal->getConnection($class);
$sql = "UPDATE `$class` SET ";
$fields = array();
foreach($data as $key => $value) {
$fields[] = "`$key` = '$value'";
}
$sql = $sql . implode(',', $fields);
$sql = $sql . \pLinq\Select::GetSqlFragment($this, true);
$db->query($sql);
}
}
?>