Subject Re: [firebird-php] Processing Firebird errors in PHP
Author Lester Caine
Todd Cary wrote:

> I would appreciate some suggestions on how errors should be processed in
> Apache/PHP. Here is a snippet of my current code:
> ...
> $sthdl = ibase_query($stmnt,$dbh);
> if ($sthdl) ibase_commit();
> if (ibase_errmsg()) {
> echo('Query: ' . $stmnt . '<br>');
> echo ibase_errmsg();
> exit;
> }
> return $sthdl;
> where $stmnt is the query statement. If I do not put the "exit" in the
> code, the function will run giving erroneous results. I would like to
> display an error page informing the surfer to contact the DBA.
> Any suggestions?

Todd - if you know that you have an error, you just need to change the
page that is created to tell you what the error is. In the above example
you want to build either an error page, or a results page.

if (ibase_errmsg()) {
<Display Error Message>
} else {
<Display Results>

The 'exit;' is just another way of not providing the 'else' and is
totally acceptable if not as tidy as showing the 'program flow'

Lester Caine
L.S.Caine Electronic Services