really quick question
please look at the following example
$dbConnect = mysql_connect($host , $username , $password) or die ("BIT OF A PROBLEM PLEASE COME BACK LATER");
is this a good way to do it or should I maybe use
$dbConnect = mysql_connect($host , $username , $password);
if(!$dbConnect)
{
echo "COULD NOT CONNECT !!";
}
else
{
echo "CONNECTED !!";
}
If you could explain which way is best it would be a great help too.
also to add I have error_reporting(0); set
thanks
The second is 2000-times more preferable to the first. In the first method all the user will see is a blank page with the text “BIT OF A PROBLEM…” – not very user friendly.
With the second method you could do whatever you like, such as send an automated e-mail to support staff while re-directing users to a nicely presented error page telling them you’ve been notified of the problem and working on it etc. If you have a second server you could also try connecting to that one as well before giving up completely.