Subject Re: **SPAM** Re: [firebird-php] auto increment last insert
Author Lester Caine
Johan van Zyl wrote:

> I am on PHP4, so I cannot use
> $userid=ibase_gen_id(G_USERS) ?
> I also have a Trigger T_USERS
> AS
> begin
> if ( (new.userid is null) OR (new.userid <= 0) ) then
> begin
> new.userid = gen_id( g_USERS, 1 );
> end
> end
> which is not required if
> $userid=ibase_gen_id(G_USERS) ?
> would work?

The trigger is useful if you don't need to remember the userid every
time. If you 'INSERT' without a valid userid the trigger will insert it.
Or if you have other applications inserting the data. So it does not
cause a problem if you leave it in place. ibase_gen_id simply wraps the
previous code in a nice name, so you don't need the ibase_query +
getting the result, all of this has nothing to do with how the database
server works itself.

Lester Caine
L.S.Caine Electronic Services