wayne Posted December 16, 2006 Share Posted December 16, 2006 I have a form that a client uses to add records to a database. The php connection code is: $boxingdayrun = mysql_pconnect($hostname_dbname, $username_somename, $password_somepassword) or die(mysql_error()); So a client is using the form to add about 40 records however we are getting errors now that states Warning: mysql_pconnect() [function.mysql-pconnect]: User online_bob has already more than 'max_user_connections' active connections in /.........../form.php on line 10 User online_bob has already more than 'max_user_connections' active connections I have been using this code for a couple years without any problems. Is there something else I can use so that each time the form is used, it will work without the error? Thanks Quote Link to comment Share on other sites More sharing options...
TCH-Andy Posted December 16, 2006 Share Posted December 16, 2006 Hi Wayne, Try changing from pconnect to connect. Whilst persistent connections eleminate the overheads during creation of new connections, mysql takes relatively short time for creating new connections and often the benefit of using persistent connections is not noticeable. Also, considering the drawbacks of using persistent connections its advantages are negligible. You may have also have to check your code and verify that all mysql sesstions are getting closed after the script execution. Quote Link to comment Share on other sites More sharing options...
wayne Posted December 16, 2006 Author Share Posted December 16, 2006 Thanks Andy I have this at the bottom of the page, is this what you mean? <?php mysql_free_result($Recordset1); ?> My understanding (limited) was that this closed the session so I should not have this problem. Quote Link to comment Share on other sites More sharing options...
wayne Posted December 16, 2006 Author Share Posted December 16, 2006 OK did some research and have added mysql_close(); to the bottom of my pages, hope this solves the problem Quote Link to comment Share on other sites More sharing options...
TCH-Andy Posted December 16, 2006 Share Posted December 16, 2006 You chould really mysql_close($db); at the end - not just free the result memory with mysql_free_result(); I don't think the mysql_free_result would not close the connection when using pconnect. Quote Link to comment Share on other sites More sharing options...
TCH-Andy Posted December 16, 2006 Share Posted December 16, 2006 You beat me to it Quote Link to comment Share on other sites More sharing options...
wayne Posted December 20, 2006 Author Share Posted December 20, 2006 Well my problem re-appeared today. Confusing since I only have two forms up at the moment while most of the year I have about 20 going at once and have never had this problem before. Help desk has told me to make sure I am closing my db sessions and not using persistent connections. Here is the code I am using. Would appreciate if someone can have a look to see if I am overlooking something. $hostname_mydbconnection = "localhost"; $database_mydbconnection = "xxxxxxxxx"; $username_mydbconnection = "xxxxxxx"; $password_mydbconnection = "xxxxxxx"; $mydbconnection = mysql_connect($hostname_mydbconnection , $username_mydbconnection , $password_mydbconnection ) or die(mysql_error()); bunch of code that reads, inserts data to the database At the end of the page I have: <?php mysql_free_result($Recordset1); mysql_close($mydbconnection ); ?> ************** So I thought that this should end the connection and that this page can be reloaded as often as necessary without problems. Am I missing something? Help desk did say that they have reset the mysql connections however not sure if this will happen again. When it does, all my forms stop working. Thanks Quote Link to comment Share on other sites More sharing options...
wayne Posted January 6, 2007 Author Share Posted January 6, 2007 Well my problem just came back. Currently I have only about 4 pages using the same user,whereas for the last few years I have had 80+ and have never had this error. I am suspecting that something is certainly wrong with some settings. Anyone else run into this problem? I am on server 365 i have submitted another help desk ticket but wondered if the community at large could offer any insights. Quote Link to comment Share on other sites More sharing options...
TCH-Bruce Posted January 6, 2007 Share Posted January 6, 2007 Wayne, please open a ticket with the help desk if you feel it is a server setting. Quote Link to comment 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.