|
Posted by Toby A Inkster on 06/28/07 12:59
wizard wrote:
> But it just displays the following and ends the script.
>
> PHP Warning: pg_query(): Query failed: ERROR: duplicate key violates
> unique constraint "contacts_email_key" in /tmp/transaction.php on line
> 80
> Failed to execute command2.
From the code posted, that is to be expected.
The pg_query issues a warning, but continues. If you want to suppress this
warning, then use the @-operator. The $result===FALSE condition evaluates
to TRUE, so the interpreter executes the conditional block, which does the
following:
* prints out "Failed to execute command2"
* rolls back the transaction
* executes a "return" instruction
At a guess, "return" doesn't mean what you think it means. "return" means
"I'm finished with this function/script. Stop processing any more of it".
That is why the script finishes here.
--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.12-12mdksmp, up 7 days, 16:33.]
Long-Awaited Zeldman Article
http://tobyinkster.co.uk/blog/2007/06/27/zeldman-in-time/
[Back to original message]
|