I have recently had a problem with our website. Users/visitors were being denied a connection to the database. When I tried to log on via PHPMyAdmin and it came back with this message: "#1203 - User already has more than 'max_user_connections' active connections."
It is a shared host, and the maximum connections allowed is 20, apparently. I cant change this, but the site doesnt usually have more than 20 on at any one time, and the error showed up for about an hour or two.
When I asked the host what the problem is, all the sent back was this: "We are afraid this has something to do with poor scripts and was filling all of your allotted connections to the database (20). You need to check the scripts and data assets you are trying to return".
What does this mean exactly?
This is a typical piece of code I am using:
session_start();
require 'include.php';
mysql_connect($DBhost,$DBuser,$DBpass);
mysql_select_db("$DBName");
I know the information here doesnt give much in the way of specific scripts, but I am wondering if there is a problem with the connection not being closed? Any one with any ideas would be of great help and I could look at this. Is there any coding errors that can cause this? As shouldnt the connection automatically close after the page has loaded?
Thank you in advance