Right way to do the MySQL thing

From: Date: Fri, 08 Mar 2002 18:03:06 +0000
Subject: Right way to do the MySQL thing
Groups: php.general 
Request: Send a blank email to php-general+get-87799@lists.php.net to get a copy of this message
I was just wondering what the "right way" to do the MySQL connection thing is. Am I supposed to do it everytime through in the php code, should I make it a session variable, or is a global variable the way to go? Right now this is the code that I have if (empty($_SESSION['db'])) { $_SESSION['db'] = mysql_connect("localhost", "root"); mysql_select_db("clients",$_SESSION['db']); } Is that a "good" way to do it or is there a "better" way or anything like that. Thanks, Dave

« previous php.general (#87799) next »