I've been coding with PHP and mySQL for years. And this part has never sat
right with me and finally I'm getting the nerve to ask how the pros out
there do this...
What I do is have a "db.php" file that contains:
$db = mysql_connect ("localhost","username","password")
or die ("Could not connect to SQL server.");
or die ("Could not select Database");
Then at the top of every page, I require_once("db.php");
But it just seems so wasteful to keep making that mysql_connect().
Isn't there a way to store the $db result so I don't have to keep
And how about the mysql_select_db() part too? Since I'm going to stay in the
same db most of the time.
I thought I read that I can't use a $_SESSION for it, and that's the only
way I know of to have it be available on each page?
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php