Hi,
I’m migrating some of my own PHP code to MODx revolution, but something goes wrong in a query - to one of my own tables.
I am still using the db API (in this case: db->getValue).
The error I get (in firebug) is the following:
E WARNING: PDO::query() expects parameter 1 to be string, object given.
Some of the detailed information:
C:\Data\webdev\modx-fyp\core\xpdo\xpdo.class.php
1737
trigger_error()
C:\Data\webdev\modx-fyp\core\model\modx\dbapi.class.php
147
xPDO->query( PDOStatement(’queryString’=>’SELECT eorder FROM eigens...1" ORDER BY eorder DESC ’))
C:\Data\webdev\modx-fyp\core\model\modx\dbapi.class.php
450
DBAPI->query( PDOStatement(’queryString’=>’SELECT eorder FROM eigens...1" ORDER BY eorder DESC ’))
C:\Data\webdev\modx-fyp\assets\beheer\prodHandling.php
443
DBAPI->getValue( PDOStatement(’queryString’=>’SELECT eorder FROM eigens...1" ORDER BY eorder DESC ’))
The full query: ’SELECT eorder FROM eigenschap WHERE ecid="1" ORDER BY eorder DESC ’
Some environment information:
Windows, XAMPP-win32-1.7.3
(Apache 2.2.14, MySQL 5.1.41 + PBXT engine, PHP 5.3.1)
Is this a bug, or did I do something wrong?
-
MODX Staff
- 10,725 Posts
I’m not following the detailed info you have posted or how it was generated. Can you simply post your code that uses the DBAPI?
Hello Open Geek,
Thanks for your response.
See attachment for a relevant part of the code.
In trying to give you the relevant part of the code I found out that the problem has something to do with my use of firephp for debugging.
If the following three lines are removed from the code, getValue works as it should:
$firephp->registerErrorHandler($throwErrorExceptions=TRUE);
$firephp->registerExceptionHandler();
$firephp->registerAssertionHandler($convertAssertionErrorsToExceptions=TRUE,$throwAssertionExceptions=FALSE);
But getRow works fine in both situations.
Perhaps I should go for a different debugging solution...
Best regards,
Marco (Black Raven)
-
MODX Staff
- 10,725 Posts
Revo provides default and allows custom error_handlers; it also includes logging functionality that can be directed to file, output to the pages, or to a modRegister instance. See modX::log() and related functions for this.
Unfortunately I’m not personally familiar with FirePHP, but I bet a modRegister instance could be authored to integrate it so that you get custom and core debug info logged in one convenient place using the modX::log() function.
If I get time I’ll look into what the conflict may be.
OpenGeek,
Did you already find some time to look into this issue?
(would be a miracle with all the other things you’re doing, but one can always hope...)
-
MODX Staff
- 10,725 Posts
No, unfortunately I am pretty swamped atm. If someone with FirePHP experience could assist, that’d be wonderful.
Ok; thanks for all the good work! (I’m afraid I just use firephp; I don’t know how it works...)
For further information:
I am (again) trying to get my PHP code working in the Revolution environment, now without any firephp calls, but I have more or less given up on the DB API.
I now just continuously test my PHP code - get an error or warning on some DB API call - and replace that call by an xPDO call. I have been doing that for the last two days and I still have a lot of database-interaction to go, but I’m getting there...