PDA

View Full Version : Help when mysql is down


cfavager
11-3-03, 01:57 PM
Right...I guess we're all aware of the current problems (again)

When you try and access my forum you get this....

"Warning: mysql_connect() [function.mysql-connect]: Can't connect to MySQL server on 'mysql02.powweb.com' (60) in /www/c/cfavager/htdocs/db/mysql4.php on line 48

Warning: mysql_error(): supplied argument is not a valid MySQL-Link resource in /www/c/cfavager/htdocs/db/mysql4.php on line 330

Warning: mysql_errno(): supplied argument is not a valid MySQL-Link resource in /www/c/cfavager/htdocs/db/mysql4.php on line 331
phpBB : Critical Error

Could not connect to the database"

Not very user-friendly

I thought I saw something in a post that was just deleted(!?) that said you could change the error message to something more read-able?

Any ideas?

devinemke
11-3-03, 02:36 PM
$connect = @mysql_connect ('server', 'user', 'password');

if (!$connect)
{
echo 'This is a friendly error message that says that the database in not available!';
}

else
{
echo 'The database is responding just fine';
// rest of your code
}

cfavager
11-3-03, 02:38 PM
Originally posted by devinemke

$connect = @mysql_connect ('server', 'user', 'password');

if (!$connect)
{
echo 'This is a friendly error message that says that the database in not available!';
}

else
{
echo 'The database is responding just fine';
// rest of your code
}


Thanks mate...but what do I do with it?

fmgt1999
11-3-03, 02:41 PM
Hi Devin,

Where do I add that script to make it work correctly?

Thanks,
Kyle

devinemke
11-3-03, 02:43 PM
replace your current database connection routine with the above code sample.