Re: PEAR DB Limit support?
| From: | Tomas V.V.Cox | Date: | Sun, 06 Jan 2002 17:08:51 +0000 |
| Subject: | Re: PEAR DB Limit support? | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-652@lists.php.net to get a copy of this message | ||
Peter Bowyer wrote:
>
> Hi,
>
> Can someone please tell me if there's now a way to emulate the LIMIT clause
> for queries? I can't find it documented anywhere, but it appears to have
> been discussed ont eh ailing list.
>
It works so:
/*
$db->limitQuery($query, $start, $count);
$query The query to "limit"
$start The row number to start fetching (starts on 0)
$count The number of rows to fetch
*/
$res = $db->limitQuery('SELECT * FROM table', 0, 20);
while ($res->fetchInto($row)) {
print_r($row);
}
Its avaible for all the backends. Plans to extend it's ability to
getAssoc(), getAll(), getCol() and execute() are in mind.
Tomas V.V.Cox