|Subject||RE: [firebird-support] Insert and Generators|
>$newaccountid = $db->get_var("SELECT GEN_ID(GEN_ACCOUNT,1) FROM
> I am using an oninsert trigger and generator to provide the primary key
> for a table. After inserting the record, I want to use the value of the
> primary key just generated to insert some detail records related to the
> master record I have just created. How do I return to my php program
> the value of the primary key? I am using an insert statement in the php
> script at the moment to inert the data for both tables.
(or equivalent) will get the new value. Use it in your insert statement and
in the subsequent detail records FK. Ensure your trigger tests for NULL and
does not get a new gen value when it's being given one already.