Page 1 of 1

Error Page, How can i make one

Posted: Mon May 29, 2006 11:10 am
by tecktalkcm0391
Is this possible:

A user is browsing my site, and then they come to a page that has errors on it, PHP see's that there is errors and then redirects them to another page that says we are expecing errors please try again later.

Posted: Mon May 29, 2006 11:26 am
by twigletmac
What kind of errors are you talking about?

Mac

Posted: Mon May 29, 2006 12:11 pm
by tecktalkcm0391
Any error but mostly just MySQL Errors

Posted: Mon May 29, 2006 2:34 pm
by Oren
Yes, it is possible. What kind of help do you need then?

Posted: Mon May 29, 2006 2:59 pm
by tecktalkcm0391
What I want is that when an error message, no matter what it is, comes up, it fowards the User to "error.php"

On error.php all it says is: Sorry but an error has occured. Please try again later.

Posted: Mon May 29, 2006 4:32 pm
by ianhull
$query = "SELECT * FROM users";

if(!$query) {
$error=mysql_error();
include_once("error.php");

// or you could use
echo '<meta http-equiv="refresh" content="0;URL=error.php" />';
exit();
}

Posted: Mon May 29, 2006 4:35 pm
by Chris Corbyn
Are you referring to PHP script errors? Like "call to undefined function foo() on line 26" ?

In PHP5 exception handling can do that for you.

Posted: Mon May 29, 2006 9:32 pm
by tecktalkcm0391
I only have PHP Version 4.4.1 and i can update because I have my website hosted by someone else.

Any way in PHP Version 4.4.1?

I didn't really get the expection handling anyway.

Posted: Mon May 29, 2006 10:11 pm
by John Cartwright
set_error_handler() is your friend ;)