petersro Posted December 8, 2008 Share Posted December 8, 2008 i have an confusing problem here is the code sys_error <?php /** * @author * @copyright 2008 */ if(isset($_GET['error=conn_error'])): echo "Im sorry the system could not connect to the database server"; elseif(isset($_GET['error=conn_error'])): echo "Im sorry there is a problem with the database"; else: echo "An unknown error has occured"; endif; ?> sys_mysql.php <?php /** * @author * @copyright 2008 */ //System loading what we need require ('sys_config.php'); //Starting Connections $conn = mysql_connect($db_host,$db_user,$db_pass); if(!$conn) { header("Location:sys_error.php?error=conn_error"); } $db = mysql_select_db(db_name,$conn); if(!$db) { header("Location:sys_error.php?error=db_error"); } ?> the result is an unknown error occured i know for a fact that the password i have placed for de-bugging purposes is wrong, so it should result in cant connect to db server Quote Link to comment https://forums.phpfreaks.com/topic/136140-solved-custom-error-handler-problem/ Share on other sites More sharing options...
flyhoney Posted December 8, 2008 Share Posted December 8, 2008 <?php /** * @author * @copyright 2008 */ if($_GET['error'] == 'conn_error'): echo "Im sorry the system could not connect to the database server"; elseif($_GET['error'] == 'db_error'): echo "Im sorry there is a problem with the database"; else: echo "An unknown error has occured"; endif; ?> Quote Link to comment https://forums.phpfreaks.com/topic/136140-solved-custom-error-handler-problem/#findComment-710033 Share on other sites More sharing options...
petersro Posted December 8, 2008 Author Share Posted December 8, 2008 thanks man works, but can i instead of an echo, have just a varable, like $error, then build a html layout and have echo $error to save me writing out the table for each condition Quote Link to comment https://forums.phpfreaks.com/topic/136140-solved-custom-error-handler-problem/#findComment-710042 Share on other sites More sharing options...
gevans Posted December 8, 2008 Share Posted December 8, 2008 Yes you can, you can do whatever you want with it <?php /** * @author * @copyright 2008 */ if($_GET['error'] == 'conn_error'): $error = "Im sorry the system could not connect to the database server"; elseif($_GET['error'] == 'db_error'): $error = "Im sorry there is a problem with the database"; else: $error = "An unknown error has occured"; endif; ?> Quote Link to comment https://forums.phpfreaks.com/topic/136140-solved-custom-error-handler-problem/#findComment-710043 Share on other sites More sharing options...
petersro Posted December 8, 2008 Author Share Posted December 8, 2008 thanks issue solved Quote Link to comment https://forums.phpfreaks.com/topic/136140-solved-custom-error-handler-problem/#findComment-710049 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.