Received: from news.tht.net (news.hub.org [216.126.91.242]) by hub.org (8.10.1/8.10.1) with ESMTP id e5D1xtT31607 for ; Mon, 12 Jun 2000 21:59:55 -0400 (EDT) Received: (from news@localhost) by news.tht.net (8.9.3/8.9.3) id VAA68714 for pgsql-sql@postgresql.org; Mon, 12 Jun 2000 21:59:14 -0400 (EDT) (envelope-from news) X-Authentication-Warning: news.tht.net: news set sender to using -f From: newsuser@linux2.johnmckown.net (John McKown) X-Newsgroups: linux.postgres, comp.databases.postgresql.questions, comp.databases.postgresql.sql Subject: Re: Simple search question References: <39457549.CEA07C63@ihug.com.au> Message-ID: User-Agent: slrn/0.9.6.2 (Linux) Lines: 23 Date: Mon, 12 Jun 2000 20:09:11 -0500 X-Complaints-To: abuse@swbell.net X-Trace: nnrp1.sbc.net 960861553 64.216.0.4 (Mon, 12 Jun 2000 20:59:13 CDT) Organization: SBC Internet Services To: pgsql-sql@postgresql.org X-Archive-Number: 200006/130 On Tue, 13 Jun 2000 09:42:01 +1000, Alex wrote: ]>Hi, ]> after running a script which performs an insert, a new tuple is ]>created, and a serial number is generated for it. I want to write the ]>new tuple data back to the screen, including the new serial number. ]> My question is, do I have to do a search for the tuple just inserted in ]>order to get the data back again? I am thinking there must be a faster, ]>more efficient way. ]>Thanks, ]>Alex What language is your "script" written in? Based on some previous posts, I guess you're talking about a PHP script. How did you add the tuple? I'd guess with a pg_Exec(connect_id,"INSERT ...."). From reading the doc, I think that you can get the row just inserted by using the pg_fetch_row() function, passing it the result from the pg_Exec and asking for row 0. I have not yet gotten anything running with PHP (lack of time to "play"), so I can't test this. If it doesn't work, I'd try using pg_GetLastOid() to get the OID of the inserted row. The use the pg_Exec and SELECT * WHERE OID=oid-value, followed by pg_fetch_row(). Just some thoughts. John