1
0
mirror of https://github.com/dg/dibi.git synced 2025-02-24 02:43:09 +01:00
php-dibi/examples/apply-limit.php
David Grudl 8d063fe0a1 - added DibiPostgreDriver::getIndexes()
- implemented DibiTables types autodetection
- all examples uses Nette::Debug
2008-10-28 19:31:32 +00:00

32 lines
556 B
PHP

<h1>dibi apply limit/offset example</h1>
<pre>
<?php
require_once 'Nette/Debug.php';
require_once '../dibi/dibi.php';
dibi::connect(array(
'driver' => 'sqlite',
'database' => 'sample.sdb',
));
// no limit
dibi::test('SELECT * FROM [products]');
// -> SELECT * FROM [products]
echo '<hr>';
// with limit = 2
dibi::test('SELECT * FROM [products] %lmt', 2);
// -> SELECT * FROM [products] LIMIT 2
echo '<hr>';
// with limit = 2, offset = 1
dibi::test('SELECT * FROM [products] %lmt %ofs', 2, 1);
// -> SELECT * FROM [products] LIMIT 2 OFFSET 1