Jump to content

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/136140-solved-custom-error-handler-problem/
Share on other sites

<?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;
?>

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;
?>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.