Re: PEAR DB: cannot use more than one database connection
| From: | Ferenc Engard | Date: | Wed, 17 Oct 2001 14:06:22 +0000 |
| Subject: | Re: PEAR DB: cannot use more than one database connection | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-395@lists.php.net to get a copy of this message | ||
Hello,
Martin Jansen wrote:
> Have you tried the latest version of PEAR DB? Could you please provide
> the shortest test script to demonstrate the error?
Package: php4
Version: 3:4.0.6-1
Package: php4-pear
Version: 3:4.0.6.7rc3-1
Package: apache
Version: 1.3.20-1
(Debian unstable, more-or-less regularly updated)
The script:
<?PHP
require_once("DB.php");
$db_user='root'; $db_pass=''; $db_host='linuxserver';
$db_name='informed';
$db_dsn="mysql://$db_user:$db_pass@$db_host/$db_name";
$db=DB::connect($db_dsn);
$sql="SELECT * FROM User;";
if (DB::IsError($res=$db->query($sql)))
echo "<P>error: ".$res->getMessage().", ".$res->getDebugInfo();
else
echo "Successful.<BR>\n";
$db_name='user';
$db_dsn="mysql://$db_user:$db_pass@$db_host/$db_name";
$xx=DB::connect($db_dsn);
if (DB::IsError($res=$db->query($sql)))
echo "<P>error: ".$res->getMessage().", ".$res->getDebugInfo();
else
echo "Successful.<BR>\n";
?>
The result:
------------------------------------
Successful.
error: DB Error: no such table, SELECT * FROM User; [nativecode=Table
'user.User' doesn't exist]
------------------------------------
As you can see, I am trying two times the same query to the same
connection, with different result: the 2nd one tries on a bad database.
:(
John, what do you mean "create two userid's"?
Circum
PS: I am using midgard module, if it counts...