Jump to content

Warning: mysql_connect() [Is if possible to redirect if error message?]


Recommended Posts

Once in a while when our hosting company has problems out site breaks and shows some ugly error messages:

 

"Warning: mysql_connect(): Too many connections in ./settings.inc.php on line 90"

 

This of course looks very unprofessional.

 

What can I do to redirect the user to an "under maintenance" page, every time the problem occurs?

 

Thanks a lot!!

 

Montgomery

I found the line 90 in settings.inc.php where the error occurs:

 

if(!mysql_connect($DbHost,$DbUser,$DbPassword)) {
$NOTCONNECTED = TRUE;
}

 

could I just change it to:

 

if(!mysql_connect($DbHost,$DbUser,$DbPassword)) {
$NOTCONNECTED = TRUE;
        header("Location: www.sample.php");
}

  Quote

could I just change it to:

 

if(!mysql_connect($DbHost,$DbUser,$DbPassword)) {
$NOTCONNECTED = TRUE;
        header("Location: www.sample.php");
}

 

Yes, although the variable $NOTCONNECTED will be linked somewhere else in the script, so I would check that out to see what it does.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.