function Fetch($result="") { if (empty($result)) {$result = $this->result;} return mysql_fetch_assoc($result); }
} ?> [/CODE]
I create two objects in my index.php file:
[CODE] <?php session_start();
include('website/includes/connection.php'); $progdb = new connection("progdb"); $coredb = new connection("coredb"); ?> [/CODE]
If I do something like:
[CODE] $query = "SELECT Count(skuID) FROM sku"; $result = $coredb->Query($query); if ($result & mysql_num_rows($result) > 0) { //CODE } [/CODE]
It works, however doing the same with the progdb (with proper tables) does not, the Query function returns false.
BUT... if I swap the order in which they are created (so $coredb before $progdb) then the opposite is true, the progdb queries work but the coredb queries fail.
What am I doing wrong? I hope I have provided enough information. I am stumped.
I don't know why someone said useless, but it does have that pesky kernel driver bundled, and it's in perennial turmoil. When it goes bad, it goes very bad, and it's impossible to predict when it will due to system differences. I know that they're in the middle of development for a major new version that will include a completely new driver, one that they expect will largely solve the problem, but that's a ways out and it's unproven at this point.
Question
firey
Okay, so I am working on a website that will use 2 database connections. The connection class looks like:
I create two objects in my index.php file:
<?php
session_start();
include('website/includes/connection.php');
$progdb = new connection("progdb");
$coredb = new connection("coredb");
?>
[/CODE]
If I do something like:
$query = "SELECT Count(skuID) FROM sku";
$result = $coredb->Query($query);
if ($result & mysql_num_rows($result) > 0)
{
//CODE
}
[/CODE]
It works, however doing the same with the progdb (with proper tables) does not, the Query function returns false.
BUT... if I swap the order in which they are created (so $coredb before $progdb) then the opposite is true, the progdb queries work but the coredb queries fail.
What am I doing wrong? I hope I have provided enough information. I am stumped.
Link to comment
https://www.neowin.net/forum/topic/1136310-php-multiple-database-connections-causing-issues/Share on other sites
3 answers to this question
Recommended Posts