Sublime directory Surf the web anonymous Pagerank Monitor


is mysql_close not needed in access_user_class?

fergalfrog
Tue 8 August 2006, 08:46 am GMT +0200
Hi - I am using your user class which I have found very useful.

However I was just wondering if mysql results connections need to be closed with:

mysql_free_result();
mysql_close();

Is a new connection made each time - just wondering if this is extra unnecessary overhead?

Thanks,
fergal

Nikolas
Tue 8 August 2006, 08:47 am GMT +0200
php automatically closes the connections when a script ends execution.

fergalfrog
Tue 8 August 2006, 09:00 am GMT +0200
thanks for the speedy response. So what are mysql_free_result and mysql_close used for then? and why have I been using them in my code up to this.

Thanks again,
Fergal

Nikolas
Tue 8 August 2006, 09:03 am GMT +0200
Well they just decrease the overhead by a bit, because if for example you do some queries and then do some other stuff that don't need the database connection, then you can close it so the server will have more resources available.

BTW welcome to webdigity fergalfrog :)

olaf
Tue 8 August 2006, 09:06 am GMT +0200
... if you use the php function mysql_pconnect you need to close the connection.

use mysql_free_result if you have big result sets

fergalfrog
Thu 10 August 2006, 12:36 pm GMT +0200
Cool thanks for the answers guys....

Flip
Mon 24 September 2007, 07:02 pm GMT +0200
I get this error:

Warning: mysql_connect() [function.mysql-connect]: User **** has already more than 'max_user_connections' active connections in /****/****/****/httpd.www/classes/access_user/access_user_class.php on line 135

I'm not opening more connections myself somewhere. The startpage displays no errors. after browsing a couple of links at my site the error appears (at the startpage aswell if you go to 'hom').
Can i close the connection somewhere ?

olaf
Mon 24 September 2007, 07:46 pm GMT +0200
I get this error:

Warning: mysql_connect() [function.mysql-connect]: User **** has already more than 'max_user_connections' active connections in /****/****/****/httpd.www/classes/access_user/access_user_class.php on line 135

I'm not opening more connections myself somewhere. The startpage displays no errors. after browsing a couple of links at my site the error appears (at the startpage aswell if you go to 'hom').
Can i close the connection somewhere ?

ask your provider to fix this problem

Flip
Mon 24 September 2007, 09:57 pm GMT +0200
Ok, if the problem keeps occuring again i ask them to look into it. Thanks for your reply olaf.

By the way, I got my website up and running pretty nicely now. If anyone wants to know how to use access_user class with 1 file (index.php) where different sections get included instead of static pages give me a shout ;)

Archive for SMF v1.00 by N.P. Valid XHTML 1.0 Transitional