Skip to content

Commit 6072368

Browse files
committed
More clear example of properties sharing
1 parent 5ef4553 commit 6072368

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

readme.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -275,16 +275,19 @@ print_r ($products);
275275

276276
### Properties sharing
277277
Its is also possible to copy properties
278+
279+
Simple pagination example:
278280
```php
279281
$db->where ("agentId", 10);
282+
$db->where ("active", true);
280283

281284
$customers = $db->copy ();
282-
$res = $customers->get ("customers");
283-
// SELECT * FROM customers where agentId = 10
285+
$res = $customers->get ("customers", Array (10, 10));
286+
// SELECT * FROM customers where agentId = 10 and active = 1 limit 10, 10
284287

285-
$db->orWhere ("agentId", 20);
286-
$res = $db->get ("users");
287-
// SELECT * FROM users where agentId = 10 or agentId = 20
288+
$res = $db->getOne ("customers", "count(id) as cnt");
289+
echo "total records found: " . $res['cnt'];
290+
// SELECT count(id) FROM users where agentId = 10 and active = 1
288291
```
289292

290293
### Subqueries

0 commit comments

Comments
 (0)