#24206 [Opn->Bgs]: PEAR::DB does not work properly with multiple databases

From: Date: Mon, 16 Jun 2003 17:45:03 +0000
Subject: #24206 [Opn->Bgs]: PEAR::DB does not work properly with multiple databases
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-17523@lists.php.net to get a copy of this message
ID: 24206 Updated by: cox@php.net Reported By: fretnoiz at yandex dot ru -Status: Open +Status: Bogus Bug Type: PEAR related Operating System: Windows 2000 PHP Version: 4.3.2 New Comment: $result2 =& $cisDB->query("SELECT NAME FROM kod WHERE NAME='$code'"); print_r($result2->fetchRow()); "Fatal error: Call to undefined function: fetchrow() in c:\Web\htdocs\test_pear.php on line 23" The problem seems that you are not checking for errors. At the top of your code put the following lines: function pe($obj) { echo $obj->toString(); } PEAR::setErrorHandler(PEAR_ERROR_CALLBACK, 'pe'); and try again. Previous Comments: ------------------------------------------------------------------------ [2003-06-16 11:43:29] fretnoiz at yandex dot ru Description: ------------ If I create two different objects for database access, one of them does not work. For example, one DB object is connected to MySQL, second is connected to Interbase. Interbase does not return results properly. Reproduce code: --------------- define('DB_DSN1', 'mysql://max:max@localhost/autogarant'); define('DB_DSN2', 'ibase://SYSDBA:masterkey@localhost/C:\IB\autogarant'); $siteDB =& DB::connect(DB_DSN1); $cisDB =& DB::connect(DB_DSN2); $result1 =& $siteDB->query("SELECT NAME FROM kod"); if ($row = $result1->fetchRow(DB_FETCHMODE_ASSOC)) { $code = $row['NAME']; echo $code . "<br>\n"; $result2 =& $cisDB->query("SELECT NAME FROM kod WHERE NAME='$code'"); print_r($result2->fetchRow()); echo "<br>\n"; } Expected result: ---------------- The tables in the DBs contain the same data so i expect to get equivalent records. 006.905 Array ( [0] => 006.905 ) Actual result: -------------- 006.905 Fatal error: Call to undefined function: fetchrow() in c:\Web\htdocs\test_pear.php on line 23 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=24206&edit=1

« previous php.pear.dev (#17523) next »