mysql connections

wxdqz

New Member
I'm still relatively new to mysql and php.

I wrote a pretty basic application what I thought was pretty clean and low functional wise.

basically open database, make a query or two, free up the queries from memory, then close the database.

my host called and said that there were too many connections open on the mysql server and that others weren't able to connect to their mysql and that he had max connections set at 100.

is 100 connections normal? or does that seem abnormally low? the code is below. There is a few things that i'm doing with the data that i pull - and I am limiting the data to about 10 entires per call.


ex:
if (!($link = mysql_pconnect($dbserver, $dblogin, $dbpass))) {
displayerrmsg(sprintf("Internal Error %d:%s\n", mysql_errno(), mysql_error()));
exit();
}

if (!($getuser = mysql_db_query($db, $the_query ))) {
displayerrmsg(sprintf("Internal Error %d:%s\n", mysql_errno(), mysql_error()));
exit();
}

mysql_free_result($getuser);
mysql_close($link);
unset($db); //used both to try and see if there was any difference.


Is there anything wrong with my code that could also help alleviate this problem? I have read every connection thread i could find but have found nothing really that might help me out with this.

thanks,

adam
 
Back
Top