chestertb
05-01-2007, 08:52 PM
Hi All,
How do I capture and supress the following mysql_connect error;
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'user'@'localhost' (using password: YES) in ../connect.inc.php on line xx
The connection script looks like this...
$link = mysql_connect("localhost", $connect['user'], $connect['pass']);
if(! $link)
{
//abort execution and load the "Not Connected" page using header()
header("Location: http://".$_SERVER['HTTP_HOST']."/fail.htm");
}
else
{
$connected = "Y";
}
...which is as per the php on-line documentation.
What it should do, I think, is try to connect to the database, and if the connection fails (for whatever reason), it should load the fail.htm page. It doesn't. I just get the above error, followed by more as the script continues to execute and tries to access the database.
Any suggestions?
CTB
How do I capture and supress the following mysql_connect error;
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'user'@'localhost' (using password: YES) in ../connect.inc.php on line xx
The connection script looks like this...
$link = mysql_connect("localhost", $connect['user'], $connect['pass']);
if(! $link)
{
//abort execution and load the "Not Connected" page using header()
header("Location: http://".$_SERVER['HTTP_HOST']."/fail.htm");
}
else
{
$connected = "Y";
}
...which is as per the php on-line documentation.
What it should do, I think, is try to connect to the database, and if the connection fails (for whatever reason), it should load the fail.htm page. It doesn't. I just get the above error, followed by more as the script continues to execute and tries to access the database.
Any suggestions?
CTB