I have an error.php file which can be grossly simplified to:
<?
if (!isset($error))
$error = "Unspecified Error";
echo "Error: $error";
?>
It is not “normal usage” to just navigate to error.php. Rather, I would do something like:
$dbh = mysql_connect($host, $user, $pass);
if (!$dbh)
{
$error = "Can't connect to MySQL: " . mysql_error();
include('error.php');
exit();
}
That said, if the user does navigate to error.php then they will just get “Error: Unspecified Error” as expected.
All my code is working, and the error page shows up and works exactly as expected, however Zend is complaining that $error is undefined on the line: if (!isset($error)).
I realise my design pattern is awful, but I’m just throwing together something quick-and-dirty in this case.
Better idea, create a function instead:
It has the benefit of both removing the Zend issue, and you have a MUCH better design. Then: