note 6430 deleted from pg_Exec by jmoore

From: Date: Fri, 18 Aug 2000 22:57:49 +0000
Subject: note 6430 deleted from pg_Exec by jmoore
Groups: php.notes 
Request: Send a blank email to php-notes+get-2533@lists.php.net to get a copy of this message
To retrieve the data you just saved and to get an automatic serialized id, set up your table like this: <PRE> SQL: CREATE TABLE something ( "itemno" int4 PRIMARY KEY DEFAULT NEXTVAL('serial'), "name" varchar(80), ); CREATE SEQUENCE serial INCREMENT 1 START 1; ----------------- PHP Example: $result=pg_exec($conn,"INSERT INTO customer (name) VALUES ('test');"); // find out what itemno the database assigned $oid = pg_GetLastOid($result); $result=pg_exec($conn,"SELECT itemno FROM cookie WHERE oid = $oid;"); $arr = pg_fetch_array ($result, 0); $itemno = $arr[0]; </PRE>

« previous php.notes (#2533) next »