Subject RE: [firebird-php] auto increment last insert
Author Johan van Zyl
Thx!
What is $conn ?

$ret = $conn->Execute( 'SELECT GEN_ID( G_USERS, 1 ) FROM RDB$DATABASE');
//line 114
$userid = $ret->fields[0];
Fatal error: Call to a member function on a non-object in
/home/e-smith/files/ibays/Primary/html/mc/register.php on line 114

-----Original Message-----
From: Lester Caine [mailto:lester@...]
Sent: 24 November 2004 12:04
To: firebird-php@yahoogroups.com
Subject: Re: [firebird-php] auto increment last insert


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

Yahoo! Groups Sponsor
ADVERTISEMENT





----------------------------------------------------------------------------
--
Yahoo! Groups Links

a.. To visit your group on the web, go to:
http://groups.yahoo.com/group/firebird-php/

b.. To unsubscribe from this group, send an email to:
firebird-php-unsubscribe@yahoogroups.com

c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.799 / Virus Database: 543 - Release Date: 2004/11/19


[Non-text portions of this message have been removed]