Subject | Re: [firebird-php] auto increment last insert |
---|---|
Author | Lester Caine |
Post date | 2004-11-24T10:03:40Z |
Alan McDonald wrote:
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
> So then this was supposed to work? But it does not. It complains about NULLJohan
> 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
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