Re: Easiest way to add paging to DB resultset?
| From: | l Burnerheimerton | Date: | Fri, 18 Nov 2005 09:46:34 +0000 |
| Subject: | Re: Easiest way to add paging to DB resultset? | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-21981@lists.php.net to get a copy of this message | ||
> I sent you a full working example as a reply
> to your first question:
>
> http://news.php.net/php.pear.general/21950
>
> Regards,
> --
> Lorenzo Alberton
> http://pear.php.net/user/quipo
Here's what I tried:
require_once 'Pager/Wrapper.php';
$params = array(
'perPage' => 10,
'delta' => 8,
'append' => true,
'clearIfVoid' => false,
'urlVar' => 'entrant',
'useSessions' => true,
'closeSession' => true,
'mode' => 'Jumping',
);
$pager = & Pager::factory($params);
// $db included
$query = 'Select * from table';
$page = Pager_Wrapper_DB($db, $query, $pager);
foreach ($page['data'] as $row) {
print_r($row);
}
I am getting the following errors:
Warning: Cannot use a scalar value as an array in
C:\...\Pager_Wrapper.php on line 81
AND getting the following DB error:
Error: [DB Error: syntax error]
Qry: SELECT * FROM table LIMIT 0, [nativecode=1064 **
You have an error in your SQL syntax near '' at line
1]
The DB error I see is the comma after LIMIT 0. I
don't put it there but the code must so I must have a
parameter wrong somewhere causing this, right?
Any ideas how to fix these errors?
__________________________________
Yahoo! FareChase: Search multiple travel sites in one click.
http://farechase.yahoo.com