SitePoint Sponsor

User Tag List

Results 1 to 1 of 1

Threaded View

  1. #1
    SitePoint Enthusiast Chip D's Avatar
    Join Date
    Nov 2000
    Ontario, Canada
    0 Post(s)
    0 Thread(s)

    MySQL Error : Connection Error

    I don't seem to be having a great deal of luck with a particular site that I'm working on. The latest problem is that the Guest Book (Advanced Guestbook 1.0) has suddenly decided to die! I was alerted to the problem by an automated email generated by the script. The error that it is saying is MySQL Error : Connection Error. When I actually visit the page the error that is produced is as follows,
    Warning: Too many connections in /export/home/atlantic/www/guestbook/include/ on line 8
    Connection Error


    MySQL Error : Connection Error
    Error Number:
    Date : Tue, May 8, 2001 07:41:50
    IP : hidden for security reasons
    Browser : Mozilla/4.0 (compatible; MSIE 5.5; Windows 98)
    Referer :
    The offending code in the file is shown below.

    PHP Code:

    class db_sql {


    connect ($host,$user,$pwd,$dbname) {
    $this->conn_id mysql_pconnect($host,$user,$pwd);
        if (
    $this->conn_id == 0) {
    $this->sql_error("Connection Error");
        if (!
    mysql_select_db($dbname$this->conn_id)) {
    $this->sql_error("Select DB Error");

    query($query_string) {
    $this->result mysql_query($query_string,$this->conn_id);  
        if (!
    $this->result) {
    $this->sql_error("Query Error");

    fetch_array($query_id) {
    $this->record mysql_fetch_array($query_id,MYSQL_ASSOC);

    free_result($query_id) {
    sql_error($message) {
    $description mysql_error();
    $number mysql_errno();
    $error ="MySQL Error : $message\n";
    $error.="Error Number: $number $description\n"
    $error.="Date        : ".date("D, F j, Y H:i:s")."\n";
    $error.="IP          : ".getenv("REMOTE_ADDR")."\n";
    $error.="Browser     : ".getenv("HTTP_USER_AGENT")."\n";
    $error.="Referer     : ".getenv("HTTP_REFERER")."\n";
    "<b><font size=4 face=Arial>$message</font></b><hr>";
    mail("$admin_mail","Guestbook - Error","$error","From: guestbook@$sql_hostname\nX-Mailer: Advanced Guestbook");


    PHP version installed on the server is 4.0b4pl1 and MySQL Version is 3.22.32. Persistent connections are allowed and are unlimited as well. I do have access to PHP Vers 4.0.5-dev and MySQL vers 3.23.36, but that does involve a bit of code hacking, which I can do, but don't want to have to if possible.

    At the moment due to time constraints, my knowledge of PHP/MySQL is very much on a need to know basis.

    If anyone could elaborated on the above then I would be very grateful.

    Many Thanks,

    UPDATE: D'oh! Just noticed that it's not just the guestbook script thats suffering. ALL of the scripts that I use, that access MySQL are suffering from the same errors. Time to contact support me thinks.
    Last edited by Chip D; May 8, 2001 at 04:17.
    Chip D
    Chances are what I think I'm typing is nothing like what I type.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts