Quote:
try to write
@error(); ....
it wont display ...
|
Its not that I do not want it to display the error, but I want it to display the error, and just the error. I want it to clear the rest of the page before showing the error.
Quote:
Maybe this can help you.
<?
$inc = include("someFile.php");
echo $inc;
?>
|
Again, even if I put my error function in a different page and included it, it wouldnt do what I wanted. I want it to clear the page...
Quote:
|
The problem is that by having that layout on your page (all php in one place) you are missing out on php power,
|
Its the way I code. I dont use echo, or store my text in variables, its because I just close the PHP tags and then write my text, so I dont lose out on the syntax highlighting while writing large chunks of HTML. This means that if I make it output for example, the header for a table, then it outputs an error itll not only have my error, but half a chunk of table too.
Quote:
|
as shivaji suggested you should be aiming at performing the action and if it doesn’t work then output the error.
|
I split things up alot. I try to give the user as much information as I can. The main problem with my error function is that I check every single query or mysql_fetch_array or page include and error if something goes wrong, so I can get an error randomly in the middle of the page if a query goes wrong for some reason.
Quote:
|
You cannot redirect with php after the page has loaded, as all contact with the server is lost. This would have to be done with JavaScript.
|
Im not trying to redirect, im trying to clear the page.
Out of curiosity: Would the output buffer functions (ob_start() etc.) be able to help me in any way? They sound relevant but im not sure exactly what they do.
|