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.
The comment about clock speeds not changing is actually not really true. Due to aggressive power management, clock speeds on an idle system are lower now than they have been in decades. It isn't uncommon for a laptop to be hovering right around 1GHz if it isn't working on anything. Yes you right that more work gets done with each cycle, but you are still dealing with a nearly 5x difference between low and high power states, which can change how snappy the interface feels.
I totally agree with you about the action center and other Windows UI elements taking a shameful amount of CPU cycles to do basic functions, but I see that as a separate conversation.
While I do agree with the "don't sweep that under the rug" concern, I also don't want to get into a debate about what things deserve a boost or not. In my opinion, boost all the things, get the full value from your CPU.
Keep in mind, we are talking about milliseconds of boosting, it isn't meaningfully going to change power consumption.
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