Good error flagging | PHP
- by Wayne
For everyone that was thinking of the error_reporting() function, then it isn't, what I need is whenever a MySQL query has been done, and the statement has like
if($result)
{
echo "Yes, it was fine... bla bla";
}
else
{
echo "Obviously, the echo'ing will show in a white page with the text ONLY...";
}
Whenever statements have been true or false, I want the error to be appeared when redirected with the header() function and echo the error reporting in a div somewhere on the page.
Basically something like this:
$error = '';
This part appears inside the div tags
<div><?php echo $error; ?></div>
So the error part will be echoed when redirected with the header()
if($result)
{
$error = "Yes, it was fine... bla bla";
header("Location: url");
}
else
{
$error = "Something wrong happened...";
header("Location: url");
}
But that just doesn't work :(