|
-
Jan 10th, 2003, 08:56 AM
#1
Thread Starter
Hyperactive Member
make error page in php if sql error?
How would I go about saying if there is any php errors it doesnt load that page. It just loads the error page. I was thinking that i have a page called error.php it would detect if there are any errors . I would just include error.php to every page. Does anyone think they can help me out with this? If it doesnt make any sence just ask ill try to explain it differently. Thanks!
edit: Im sorry i ment to say if there was a MySQL error. Because I would like it to be like vBulletin how if it can not connect to the database it loads that page that says so, and to contact the admin. If you can help me with this that would be great.
Last edited by Muk108; Jan 10th, 2003 at 09:06 PM.
-
Jan 10th, 2003, 06:27 PM
#2
Frenzied Member
you have to set error_reporting to 0 I beleive then you have to log the loading process, so it is does have an error it will stop loading. you can't just stop at the beginning as the pages starts to load and recieves the error you will have half the page loaded.
also I believe there is a setting in the ini file that will report all errors to a log file without doing any code.
you will also have to make your own error catching function.
-
Jan 10th, 2003, 09:04 PM
#3
Thread Starter
Hyperactive Member
ok, Well I think I asked the wrong thing. I should have said if there where any MySQL errors like it couldnt connect to the database then it loads a different page. Could that be done?
-
Jan 12th, 2003, 06:01 PM
#4
Frenzied Member
you could try this
$start = mysql_query($query_string);
if (!$start){
header ("Location: page.php");
}
but you canot echo anything before that to the browser or you will get an error. you could use an include if you wanted to.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|