It's late. I'm tired.
Just working out a paginator for a database query.
my query works fine. When I use the DB function "limitQuery()" My pager pukes up an error.
My Database connection is good, the query runs fine alone.
The documentation defines the parameters for the function, I'm right on in my syntax:
here's the offending code
and the error
I've been in the code for DB, DB/common, DB/Pager and finally found the call to isManip in mysql.php this is where the thing chokes. isManip is the functin that calls preg_match(). This doesn't kill the script until I try to access the $pages.
The call to mysql::modifyLimitQuery() is from within the DB::common::limitQuery() function this only calls the query portion of the parameters above; $sql. This is the second parameter passed is the query, if you look at the regex in preg_match() I would say that 'select' is a 'string.' ... Ain't it? The function should return "false" but it chokes. Why?
Before i throw this attempt out the window can anyone see where i might be going wrong?
I am going to just skip the limitQuery() call and use the the syntax found within the mysql::modifyLimitQuery(). should work we'll see. it's damn near 2:00 AM and I'm too old to sit up all night playing with computers.
System Information:
Now While trying to debug this little feature I've come up with a couple of my own solutions to the pagination issue but would like to understand just what the hell is going wrong here. maybe a fresh eye can spot a glaring mistake (other than using PHP pearDB in the first place)
Anyone?
Thank you and good night
FF
Just working out a paginator for a database query.
my query works fine. When I use the DB function "limitQuery()" My pager pukes up an error.
My Database connection is good, the query runs fine alone.
The documentation defines the parameters for the function, I'm right on in my syntax:
here's the offending code
| Code: |
|
$offset = 1 \\ -tried 0, "1" & "0" $limit = 5 \\ -same here, tried with and without quotes $sql = $dbcon->query('SELECT * FROM item'); \\ -simple; no? $pages=$dbcon->limitQuery($sql, $offset, $limit); \\ -Uh oh |
and the error
| Code: |
|
Warning: preg_match() expects parameter 2 to be string, object given in /usr/local/lib/php/DB.php on line 631 $err=$pages->getmessage(); print ("$err"); this snippet gives me.. DB Error: syntax error |
I've been in the code for DB, DB/common, DB/Pager and finally found the call to isManip in mysql.php this is where the thing chokes. isManip is the functin that calls preg_match(). This doesn't kill the script until I try to access the $pages.
The call to mysql::modifyLimitQuery() is from within the DB::common::limitQuery() function this only calls the query portion of the parameters above; $sql. This is the second parameter passed is the query, if you look at the regex in preg_match() I would say that 'select' is a 'string.' ... Ain't it? The function should return "false" but it chokes. Why?
Before i throw this attempt out the window can anyone see where i might be going wrong?
I am going to just skip the limitQuery() call and use the the syntax found within the mysql::modifyLimitQuery(). should work we'll see. it's damn near 2:00 AM and I'm too old to sit up all night playing with computers.
System Information:
| Code: |
|
Output from php -v: PHP 5.0.4 (cli) (built: Aug 13 2005 19:07:01) Copyright (c) 1997-2004 The PHP Group Zend Engine v2.0.4-dev, Copyright (c) 1998-2004 Zend Technologies DB.php version: @version CVS: $Id: DB.php,v 1.80 2005/02/16 02:16:00 danielc Exp $ And mysql.php: CVS: $Id: mysql.php,v 1.117 2005/03/29 15:03:26 danielc Exp $ MySQL status: Connection id: 160 Current database: mysql Current user: root@localhost SSL: Not in use Current pager: stdout Using outfile: '' Using delimiter: ; Server version: 4.1.12-standard Protocol version: 10 Connection: Localhost via UNIX socket Server characterset: latin1 Db characterset: latin1 Client characterset: latin1 Conn. characterset: latin1 UNIX socket: /tmp/mysql.sock Uptime: 13 hours 28 min 8 sec Apache server-info: Server Version: Apache/2.0.54 (Unix) mod_ssl/2.0.54 OpenSSL/0.9.7e PHP/5.0.4 mod_perl/2.0.1 Perl/v5.8.6 |
Now While trying to debug this little feature I've come up with a couple of my own solutions to the pagination issue but would like to understand just what the hell is going wrong here. maybe a fresh eye can spot a glaring mistake (other than using PHP pearDB in the first place)
Anyone?
Thank you and good night
FF
