Page 1 of 1

Mysql connection

Posted: Mon Jun 19, 2006 12:58 am
by webstyler
Hi, we have end site layout (really fast and made with css+xhtml) so we have insert the mysql connection

The page load seems very very slow at middle of page
Page is load within middle, after there are pause of 1/2 second and after load continue ..

we don't have meet this problem

so, we have comment all last row code..

the row that make problem is mysql connection:

$conn = mysql_connect($_CONFIG['host'], $_CONFIG['user'], $_CONFIG['pass']) or die('Impossibile stabilire una connessione');
mysql_select_db($_CONFIG['dbname']);

Have you any idea ??
thks

ps. sorry x bad english - any correction thks

Posted: Mon Jun 19, 2006 7:26 am
by GM
Ciao - se preferisci scrivere in Italiano, mandami un PM e proverò ad aiutarti io...

Otherwise, I can suggest to look at where your $_CONFIG variable is being populated.

Is it quicker if you (temporarily) hardcode the server, username and password details?

Do you have any other queries running on the page?

Posted: Mon Jun 19, 2006 10:34 am
by webstyler
GM wrote:Ciao - se preferisci scrivere in Italiano, mandami un PM e proverò ad aiutarti io...

Otherwise, I can suggest to look at where your $_CONFIG variable is being populated.

Is it quicker if you (temporarily) hardcode the server, username and password details?

Do you have any other queries running on the page?
Ciao, thx, ma proviamo qui in lingua :)

$_CONGIF is populate 20 row up with simple

$_CONFIG['host'] = "localhost";
$_CONFIG['user'] = "**";
$_CONFIG['pass'] = "**";
$_CONFIG['dbname'] = "**";

Nothing change :(

Site is under develop so is on local server

All query is with // or /**/ .. only connection active

thks

Posted: Mon Jun 19, 2006 11:48 am
by GM
Which version of PHP/mySQL are you using?

I tend to establish my connections using the following OO syntax:

Code: Select all

$conn = new mysqli("localhost", "user", "password", "dbname");
Note that I'm using the "mysqli" library which is for mySQL after 4.2 (I think). I have never noticed any delay, but this may be because practically the first thing I do on my pages is open the connection to the database, which means that any delay might not be immediately noticed, due to normal page loading times.

Maybe someone can suggest some diagnostics tools that would be useful in this?