PEAR DB and 2 databases
| From: | Unknown Sender | Date: | Wed, 21 May 2003 08:04:18 +0000 |
| Subject: | PEAR DB and 2 databases | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-5496@lists.php.net to get a copy of this message | ||
Does anyone know how to make PEAR DB work with 2 databases?
I have the following example:
<?php
require_once 'DB.php';
define('DB_DSN1', 'mysql://max:max@localhost/autogarant');
define('DB_DSN2', 'ibase://SYSDBA:masterkey@/D:\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 KOD FROM goods WHERE KOD='$code'");
print_r($result2->fetchRow());
echo "<br>\n";
}
?>
It causes the warning:
Warning: ibase_fetch_row(): supplied argument is not a valid InterBase
result resource in d:\php4\pear\DB\ibase.php on line 214
When I use native mysql and ibase APIs, everything works fine.
--
Best regards,
Maxim mailto:fretnoiz@yandex.ru