Welcome Guest, Not a member yet? Register   Sign In
Dealing with db errors
#1

[eluser]september28[/eluser]
Hi there,

Was just wondering how people deal with db errors in their apps. at the moment i code using the following methodology:
Code:
$query = $this->db->get();
$result = $query->result();
if ($result) {
//do something
return $result;
}
return false;

So basically the next step will only happen as long as the db query went ok. but what if it didnt? then the function would just return false which isn't very useful. I was just wondering how people deal with db errors - I myself would like to inform the user that a db error has occured and perhaps log the exact details somewhere for me to sift through and work out why the error occurred.

Is there any standardized way of doing this that i can apply to all my functions in the same way? Does anyone have any other ideas?

Cheers, Dan


Messages In This Thread
Dealing with db errors - by El Forum - 04-30-2009, 05:31 AM
Dealing with db errors - by El Forum - 04-30-2009, 05:55 AM
Dealing with db errors - by El Forum - 04-30-2009, 07:22 AM
Dealing with db errors - by El Forum - 05-03-2009, 03:38 AM
Dealing with db errors - by El Forum - 05-03-2009, 03:50 AM
Dealing with db errors - by El Forum - 05-03-2009, 05:37 AM



Theme © iAndrew 2016 - Forum software by © MyBB