If you are receiving a mysql_connect error on your web site, such as

Warning: mysql_connect() [function.mysql-connect]: Too many connections in /imedia/users/user/htdocs/connect.php on line 7

You may want to consider making some modifications to your code, per the PHP.NET Manual, to resolve these errors.

  • mysql_connect()
    The advantage of using mysql_connect() for connections to MySQL databases in your code is that the link to the server will be closed as soon as the execution of the script ends, unless it's closed earlier by explicitly calling mysql_close()
  • mysql_close()
    This explicitly closes the connections. The use of mysql_close() in conjunction with mysql_connect() would ensure that the connection is closed.
  • mysql_pconnect()
    This has a disadvantage in that the connection to the MySQL server will not be closed when the execution of the script ends. Instead, the link will remain open for future use. While this will work if you need to leave the connection open for additional connections, mysql_close() will not close links established by mysql_pconnect().

More information can be found in mysql_connect documentation.