imarockstar Posted June 1, 2009 Share Posted June 1, 2009 I am getting this error .. i have never gotten this error before and It just started happening .. Warning: mysql_connect() [function.mysql-connect]: Too many connections in /home/tourzag/public_html/scripts/settings.php on line 7 Could not connect to MySQL: Too many connections code -> <?php $dbc = mysql_connect (DB_HOST, DB_USER, DB_PASSWORD) OR die('Could not connect to MySQL: ' . mysql_error()); mysql_select_db (DB_NAME) OR die('Could not select the database: ' . mysql_error()); include(dirname(__FILE__).'/../includes/permissions.php'); //Relogin user if logged in.. if (isset($_SESSION['id']) && $_SESSION['id']) { $adsf = mysql_query("SELECT * FROM users WHERE id = '{$_SESSION['id']}'"); $_SESSION = mysql_fetch_assoc($adsf); } $permissions = new permission(); ?> Quote Link to comment https://forums.phpfreaks.com/topic/160517-solved-connection-issue-help/ Share on other sites More sharing options...
br3nn4n Posted June 1, 2009 Share Posted June 1, 2009 You have too many open connections to the database. Add a mysql_close() to fix it. Quote Link to comment https://forums.phpfreaks.com/topic/160517-solved-connection-issue-help/#findComment-847149 Share on other sites More sharing options...
imarockstar Posted June 1, 2009 Author Share Posted June 1, 2009 thats just weird that it happened all the sudden .. is there a script that will tell you how many connections that you have and maybe even the IP of the connection ? Quote Link to comment https://forums.phpfreaks.com/topic/160517-solved-connection-issue-help/#findComment-847170 Share on other sites More sharing options...
imarockstar Posted June 1, 2009 Author Share Posted June 1, 2009 and do you ALWAYS need to close the mysql connection ? a the end of each page ? or i mean ... every time you connect, do you need to end that page/script with a close ? thanks Quote Link to comment https://forums.phpfreaks.com/topic/160517-solved-connection-issue-help/#findComment-847172 Share on other sites More sharing options...
BobcatM Posted June 1, 2009 Share Posted June 1, 2009 or i mean ... every time you connect, do you need to end that page/script with a close ? That is always a good practice. Quote Link to comment https://forums.phpfreaks.com/topic/160517-solved-connection-issue-help/#findComment-847175 Share on other sites More sharing options...
imarockstar Posted June 1, 2009 Author Share Posted June 1, 2009 ok good deal ... !!! I will start doing that .. Quote Link to comment https://forums.phpfreaks.com/topic/160517-solved-connection-issue-help/#findComment-847176 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.