Welcome Guest, Not a member yet? Register   Sign In
Error handling when using database call_function()

Hi All,

I hope you can help me Smile

I am using the Postgres driver and want to call pg_query and pg_fetch_all directly, so I found the call_function() function which does what I need perfectly.

My code:

$db_id = $this->db->conn_id;
$query = $this->db->call_function('query', $db_id, "SELECT * FROM " . $table);
$result = $this->db->call_function("fetch_all", $query);

My question:

How do I trap an error that is returned by pg_query or pg_fetch_all within the call_function() wrapper? For example if $table contains a reference to an invalid table, a PHP Warning message is displayed in the browser. I want to be able to trap that in advance and handle it myself.

Any ideas?



Theme © iAndrew 2016 - Forum software by © MyBB