Best Connection practices?
I have a very busy gaming website that is fully database driven. The site receives upto 15k uniques a day and 60 million page views per month.
Currently, each new page is included into the main index.php file. The connection to the database is achieved via the following in the index.php:
The contents of the config.php file look like this:
So here is an example of what a user may do and how the site responds:
$dbserver = "localhost";
$dbuser = "userhere";
$dbpass = "passhere";
$db = "dbnamehere";
mysql_connect($dbserver, $dbuser, $dbpass);
User visits site which loads index.php. User then goes to the games page which includes games.php into the index.php file in the appropriate place. So index.php is thus loaded twice. Once with the standard data and then once with the new included file.
There is no code anywhere in any script that close the db connection.
So my question to you is - is there a problem with this setup? And if so, what would be the best way to do this.