makaveliuk
Programmer
Is there a way to have a PHP script try to connect to a server and try another server if a connection cannot be established?
I have tried the following:
$link = @mysql_connect(server, username, password);
if( !$link ) {
$link = @mysql_connect(backupserver, username, password);
if( !$link ) {
header("Location: ./error.html");
}
}
But that fails every time if the first server is unavailable even though the 'backupserver' is available.
Any ideas where I'm going wrong? Is there a way to test for a connection without actually connecting maybe?
I have tried the following:
$link = @mysql_connect(server, username, password);
if( !$link ) {
$link = @mysql_connect(backupserver, username, password);
if( !$link ) {
header("Location: ./error.html");
}
}
But that fails every time if the first server is unavailable even though the 'backupserver' is available.
Any ideas where I'm going wrong? Is there a way to test for a connection without actually connecting maybe?