Mysql connection

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
webstyler
Forum Commoner
Posts: 85
Joined: Sat Feb 14, 2004 2:16 am

Mysql connection

Post 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
GM
Forum Contributor
Posts: 365
Joined: Wed Apr 26, 2006 4:19 am
Location: Italy

Post 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?
webstyler
Forum Commoner
Posts: 85
Joined: Sat Feb 14, 2004 2:16 am

Post 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
GM
Forum Contributor
Posts: 365
Joined: Wed Apr 26, 2006 4:19 am
Location: Italy

Post 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?
Post Reply