1
0
mirror of https://github.com/dg/dibi.git synced 2025-02-22 18:02:25 +01:00
php-dibi/examples/using-limit-and-offset.php

29 lines
562 B
PHP
Raw Normal View History

2010-08-03 12:28:07 +02:00
<!DOCTYPE html><link rel="stylesheet" href="data/style.css">
2010-08-03 11:48:51 +02:00
<h1>Using Limit & Offset | dibi</h1>
2010-08-03 12:28:07 +02:00
2008-07-17 03:51:29 +00:00
<?php
require __DIR__ . '/../dibi/dibi.php';
2008-07-17 03:51:29 +00:00
dibi::connect(array(
'driver' => 'sqlite3',
'database' => 'data/sample.s3db',
2008-07-17 03:51:29 +00:00
));
// no limit
2008-10-28 02:06:55 +00:00
dibi::test('SELECT * FROM [products]');
// -> SELECT * FROM [products]
2008-07-17 03:51:29 +00:00
// with limit = 2
2008-10-28 02:06:55 +00:00
dibi::test('SELECT * FROM [products] %lmt', 2);
// -> SELECT * FROM [products] LIMIT 2
2008-07-17 03:51:29 +00:00
// with limit = 2, offset = 1
2008-10-28 02:06:55 +00:00
dibi::test('SELECT * FROM [products] %lmt %ofs', 2, 1);
// -> SELECT * FROM [products] LIMIT 2 OFFSET 1