ok what i am trying to accomplish here seems fairly easy, but i've never done this. so what i am hoping to do is, redirect a page to another using the if statement in php.

for example let's say i have a page called database.php and i would like for it to point to another file, whenever mysql is down to something like nodatabase.php.

the issue i am having how can i get the if statement clause to know when mysql goes down, to redirect it to another page, without having to use .htaccess.

if == (mysql_connect($d_host,$dbuser,$dbpass);

} else {
$ = 'show nodatabase.php instead';

i hope i didn't confuse anybody but thanks in advance.