Re: postgres version mysql_insert_id

From: Date: Tue, 18 Jul 2000 14:34:27 +0000
Subject: Re: postgres version mysql_insert_id
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-7074@lists.php.net to get a copy of this message
That makes sense. Thanks, Keith Doug Semig wrote: > You have to do it in a couple of steps to emulate the MySQL equivalent. > > /* Untested code...written off the top of my head */ > $pgoid=pg_GetLastOID(); > $result=pg_exec($conn, "SELECT id FROM table WHERE oid=$pgoid"); > $data=pg_fetch_row($result, 0); > echo $data[0]; /* or whatever you want to do with the id */ > > In the above snippet, of course, you'd adjust your SQL statement ("id" > would be the name of whatever field you use for your primary key and > "table" would be your table name) and reuse your already opened connection. > > Doug > > At 11:03 PM 7/17/00 -0700, Keith Vance wrote: > >Is there a function in PHP for getting the last insert id using > >Postgresql? pg_GetLastOid doesn't do what I thought it would. > > > >Thanks, > >Keith > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#7074) next »