Hi there,
I have a rather complex script up and running that connects to 3 individual databases.
The thing is i am a bit worried how this will effect load times and my server resources.
I initially tried to do the following at the start of my page:
$conn1 = mysql_connect(....
$conn2 = mysql_connect(....
$conn3 = mysql_connect(....
However for some reason only the first connection worked?
Also, i have 2 main parts - layout.php and layout_functions.php which contains functions for the dynamic content. Currently i am connecting to my database like this:
function test() {
$conn1 = mysql_connect(....
mysql_close($conn1);
}
function test2() {
$conn2 = mysql_connect(....
mysql_close($conn2);
}
function test3() {
$conn3 = mysql_connect(....
mysql_close($conn3);
$conn1 = mysql_connect(....
mysql_close($conn1);
}
Firstly is this a bad way of doing this? Is there a way i can globally define all 3 of my database connections to stop me connecting/disconnecting constantly?
Secondly, i believe during the execution of my script i mysql_close the currect connection and start another roughly about 15 - 20 times. Is this healthy?
My page load times do seem to be lagging sightly (not majorly), and the site is going life in a few weeks so wanted to see if i could speed it up a bit/fine tune it.
Thanks.
Jonno.