"DB Error: syntax error" when using Pager, but no error when just query it using DB

From: Date: Fri, 31 Dec 2004 19:10:20 +0000
Subject: "DB Error: syntax error" when using Pager, but no error when just query it using DB
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-16540@lists.php.net to get a copy of this message
I am getting a DB:Syntax error with the code below. When I take out all the Pager stuff and change the variables in the LIMIT query to integers instead of the pager variables, it works fine. I dump the $pager and $offset variables which are arrays. Not sure how it passes arrays to a LIMIT query where it is expecting integers but...this was the exmaple supplied. Any ideas? Thanks. <?php require_once("DB.php"); require_once('Pager/Pager.php'); // assume db connection // determine number of items to page $count = $db->getOne("SELECT COUNT(*) FROM clients"); $countPerPage = 10; $params = array( "mode" => "Jumping", "totalItems" => $count, "perPage" => $countPerPage, "delta" => 10, "append" => true, "path" => dirname($_SERVER['PHP_SELF']), "urlVar" => "page", "clearIfVoid" => true, "useSessions" => false, "pearErrorMode" => PEAR_ERROR_CALLBACK ); $pager = & Pager::factory($params); $offset = $pager->getOffsetByPageId(); $sql = "SELECT city FROM names"; //used to see what the vars contains echo "<pre>"; var_dump($pager); var_dump($offset); echo "<pre>"; $res =& $db->limitQuery($sql, $offset, $countPerPage); if (DB::isError($res)) { die($res->getMessage()); } while($row =& $res->fetchRow()) { echo $row[0]; } // display links to result pages echo $pager->getLinks(); ?> __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com

« previous php.pear.general (#16540) next »