Welcome Guest, Not a member yet? Register   Sign In
How to gracefully degrade SQL errors
#1

Hi all,

If I get an SQL error I'd like to log it and redirect the user to an error page which just informs them there has been an error.

The code I have tried below doesn't work (log_message doesn't work, the page isn't redirected and I just get the "Database Error Occurred" page.  The error (not the log_message part) is written to my log.

Where am I going wrong please?

Code:
// UPDATE
$this->db->where('fr_mach_date', $_POST['hdnMatchDate']);
$this->db->where('fr_team_code', $side);
$this->db->where('fr_double_banker', $double_banker_from);
if (!$this->db->update('fixtures_results', $arr_match_info))
//error updating the row.
{
log_message('error', 'Error updating fixture '.$_POST['hdnFixture_'.$side]);
#$error = $this->db->error();
redirect('week_fixtures/error');
}
Reply


Messages In This Thread
How to gracefully degrade SQL errors - by colin147 - 12-17-2017, 04:58 AM



Theme © iAndrew 2016 - Forum software by © MyBB