<?php
$connection = mysql_connect($host, $user, $pass);
if(!$connection)
{
header("Location: http://example.com/pageToBeRedirectedTo");
}
$db = mysql_select_db($data, $connection) or die("Error");
/* You could also have
*
*if(!$db)
*{
* header("Location: http://example.com/pageToBeRedirectedTo");
*}
*
*/
?>
PHP:<?php $connection = mysql_connect($host, $user, $pass); if(!$connection) { header("Location: http://example.com/pageToBeRedirectedTo"); } $db = mysql_select_db($data, $connection) or die("Error"); /* You could also have * *if(!$db) *{ * header("Location: http://example.com/pageToBeRedirectedTo"); *} * */ ?>