note 109549 added to function.pg-last-oid

From: Date: Fri, 27 Jul 2012 14:11:10 +0000
Subject: note 109549 added to function.pg-last-oid
Groups: php.notes 
Request: Send a blank email to php-notes+get-189428@lists.php.net to get a copy of this message
Simply getting LAST_INSERT_ID; <?php // Note: waiting for "select" part from pg_query below. // Note: separating the query parts using semicolons (;). $qry = pg_query(" INSERT INTO users (id,uname,upass,rep) VALUES (DEFAULT,'bubu','a981v',0.19); SELECT Currval('users_id_seq') LIMIT 1 "); // or $qry = pg_query(" INSERT INTO users (id,uname,upass,rep) VALUES (DEFAULT,'bubu','a981v',0.19) RETURNING Currval('users_id_seq')"); $fch = pg_fetch_row($qry); print_r($fch); ?> Array ( [0] => 3 -> Gotcha! ) ---- Server IP: 160.75.100.7 Probable Submitter: 85.101.222.218 ---- Manual Page -- http://www.php.net/manual/en/function.pg-last-oid.php Edit -- https://master.php.net/note/edit/109549 Del: integrated -- https://master.php.net/note/delete/109549/integrated Del: useless -- https://master.php.net/note/delete/109549/useless Del: bad code -- https://master.php.net/note/delete/109549/bad+code Del: spam -- https://master.php.net/note/delete/109549/spam Del: non-english -- https://master.php.net/note/delete/109549/non-english Del: in docs -- https://master.php.net/note/delete/109549/in+docs Del: other reasons-- https://master.php.net/note/delete/109549 Reject -- https://master.php.net/note/reject/109549 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#189428) next »