Subject Re: [firebird-php] auto increment last insert
Author Lester Caine
Alan McDonald wrote:

> So then this was supposed to work? But it does not. It complains about NULL
> userid
>
> $userid=ibase_query('SELECT GEN_ID(G_USERS, 1) from rdb$database');
> [Alan McDonald] notice
> ("SELECT GEN_ID(GEN_CONTACT,1) FROM RDB\$DATABASE"
> the slash.... the $ sign will not go thru otherwise

Johan
There is great fun in php with '',"" and `` so you have to take care
when using them. $ indicates a php variable, so $database gets replaced
with the contents of $database hence the need to 'escape' the $ with a
slash.
Except Alan has missed that you have changed from " to ' which ignores
the $ so you can't add php variables inline.

$ret = $conn->Execute( "SELECT GEN_ID( G_USERS, 1 ) FROM
RDB\$DATABASE" );
$userid = $ret->fields[0];

or

$ret = $conn->Execute( 'SELECT GEN_ID( G_USERS, 1 ) FROM
RDB$DATABASE' );
$userid = $ret->fields[0];


--
Lester Caine
-----------------------------
L.S.Caine Electronic Services