0

I have one shared hosting account and i am running dynamic site there. i am facing below problem sometime where database record returns.

Warning: mysql_connect() [function.mysql-connect]: User myuser already has more than 'max_user_connections' active connections in path/db.php on line 4
Could not connect: User myuser already has more than 'max_user_connections' active connections

I am closing all connections like mysql_close($con) in each file where i execute the query;

is it just because of this ? or there could be some other issue? can i trace out the problem where i am missing the mysql closing connection ?

can someone help me out ? Thanks

RanaHaroon
  • 445
  • 6
  • 20

1 Answers1

1

Do not open and close connection on each file or worse on each query. Make a file similar to connection.php where you put the mysql_connect statement and use require_once where you want to use it. do not use mysql_close since the connection gets closed automatically each time the script finishes.

SAnDAnGE
  • 438
  • 2
  • 6
  • This is not a programming problem, just quantity of resources available. And any other script that uses this class are subject to have the error. – Deepak Dholiyan Sep 21 '16 at 09:37