chanchelkumar Posted March 10, 2010 Share Posted March 10, 2010 Hi everyone.. Am getting these errors on my site periodically .. But sometimes in a refresh it will be ok... What is the issue? Can any one help me to find a solution on it.. I contacted the server guys they told all are ok with them.. IS it something wrong with my code.. Thanks in advance.. Warning: mysql_connect() [function.mysql-connect]: Too many connections in D:\Hosting\4770399\html\admin\db_connect\config.php on line 2 Warning: mysql_select_db() [function.mysql-select-db]: Can't connect to MySQL server on 'localhost' (10061) in D:\Hosting\4770399\html\admin\db_connect\config.php on line 3 Warning: mysql_select_db() [function.mysql-select-db]: A link to the server could not be established in D:\Hosting\4770399\html\admin\db_connect\config.php on line 3 Warning: mysql_query() [function.mysql-query]: Can't connect to MySQL server on 'localhost' (10061) in D:\Hosting\4770399\html\advt_dyna.php on line 3 Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in D:\Hosting\4770399\html\advt_dyna.php on line 3 Can't connect to MySQL server on 'localhost' (10061) Quote Link to comment https://forums.phpfreaks.com/topic/194739-my-sql-error-showing-issue-with-server-or-my-php-code/ Share on other sites More sharing options...
XeNoMoRpH1030 Posted March 10, 2010 Share Posted March 10, 2010 MySQL only allows so many connections to the database. That error implies that the max has been reached, so MySQL rejects the connection. If you are on shared hosting, there isn't much you can do. You could always try mysql_pconnect() which creates a persistent connection, but that could also end up with the same error. Do you use mysql_close() at the end of any of your pages? There shouldn't be a need as it's supposed to automatically close after the script execution, but you never know. I just read somewhere another person was able to stop the same connection error you are getting by implementing that. Quote Link to comment https://forums.phpfreaks.com/topic/194739-my-sql-error-showing-issue-with-server-or-my-php-code/#findComment-1024348 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.