I am creating a database driven website - and I have the content stored in a mysql database at the moment. At the moment each page starts with the script:
$connect = mysql_connect('$host', '$username', '$password');
$select = mysql_select_db('$database', $connect);
This works fine, but if Iv been playing around with the site for too long, it comes back with an error that too many database connections are open.
I have a few questions:
1) Does the script above open a new connection each time it is executed?
2) If so how can I reuse a connection across pages?
3) If not how would I stop 'too many connections' from being opened?