1
0
mirror of https://github.com/dg/dibi.git synced 2025-10-23 10:46:07 +02:00
Files
php-dibi/examples/apply-limit.php
2010-08-03 13:41:06 +02:00

32 lines
592 B
PHP

<!DOCTYPE html><link rel="stylesheet" href="data/style.css">
<h1>dibi apply limit/offset example</h1>
<?php
require_once 'Nette/Debug.php';
require_once '../dibi/dibi.php';
dibi::connect(array(
'driver' => 'sqlite',
'database' => 'data/sample.sdb',
));
// no limit
dibi::test('SELECT * FROM [products]');
// -> SELECT * FROM [products]
// with limit = 2
dibi::test('SELECT * FROM [products] %lmt', 2);
// -> SELECT * FROM [products] LIMIT 2
// with limit = 2, offset = 1
dibi::test('SELECT * FROM [products] %lmt %ofs', 2, 1);
// -> SELECT * FROM [products] LIMIT 2 OFFSET 1