Welcome Guest, Not a member yet? Register   Sign In
Manage Database Exceptions...
#1

[eluser]XeRGi0[/eluser]
Hi there!!!

I got a lil' doubt... I'm using postgres, and I want to make most of the validations process in my dbms.

Let's say I grant privileges on a table to a certain users, if a tried to "SELECT" that table won't work and an error will be triggered... "Permission denied for relation......"

Ok, i want to show that error in my application without the "Database error" page that CI shows...

I a certain user can't access to certain table, show that error in a DIV only, and let the whole app keep going...

It can be done? Thanx...
#2

[eluser]XeRGi0[/eluser]
Anyone please? I really need to implement this feature on a proyect i'm developing...
#3

[eluser]Pascal Kriete[/eluser]
The only thing I can think of is to suppress the errors and handle them yourself.

First, go into the database config file and set db_debug to FALSE. That will turn off all database errors.

Then run the query and check for errors manually. The query will return false if it fails:
Code:
// .... build the query and run it:
$result = $this->db->get($this->table);

// catch errors
if ($result === FALSE)
{
    $err_msg = $this->db->_error_message();
    // do something with the message
}

Hope that helps.




Theme © iAndrew 2016 - Forum software by © MyBB