MySQL Forums
Forum List  »  PHP

Best pratices for connections management
Posted by: Frédéric Mériot
Date: June 29, 2005 01:57AM

Hi,
I d'like to know how to deal with mysql connections in the best way.

Today, I use an include file which create a connection to my database :

global $mylink;
$dbuser = "***";
$dbpwd = "***";
$dbhost = "***";
$dbname="***";
if(!$mylink)
{
$mylink = mysqli_connect($dbhost,$dbuser,$dbpwd);
mysqli_select_db ($mylink,$dbname);
return $mylink;
}

Is it a good way?

I'am entierly recoding my site using Pear:DB and passing my data model to an object oriented model.

Do you recommend to continue to deal with a global connection or must I create connections inside my classes?

Thanks.

Options: ReplyQuote


Subject
Written By
Posted
Best pratices for connections management
June 29, 2005 01:57AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.