note 83217 added to pdo.lastinsertid

From: Date: Thu, 15 May 2008 17:28:50 +0000
Subject: note 83217 added to pdo.lastinsertid
Groups: php.notes 
Request: Send a blank email to php-notes+get-139415@lists.php.net to get a copy of this message
As said by Dennis Du Kroger, in this situation the function will return 0. But you can retrieve the last inserted Id executing a query asking for the function LAST_INSERT_ID() (at least in MySQL) Try this: ($o_db is the declared adapter) $last_id = $o_db->fetchAll('SELECT LAST_INSERT_ID() as last_id'); $last_id = intval($last_id[0]['last_id']); ---- Server IP: 80.64.47.13 Probable Submitter: 80.33.11.167 ---- Manual Page -- http://www.php.net/manual/en/pdo.lastinsertid.php Edit -- https://master.php.net/note/edit/83217 Del: integrated -- https://master.php.net/note/delete/83217/integrated Del: useless -- https://master.php.net/note/delete/83217/useless Del: bad code -- https://master.php.net/note/delete/83217/bad+code Del: spam -- https://master.php.net/note/delete/83217/spam Del: non-english -- https://master.php.net/note/delete/83217/non-english Del: in docs -- https://master.php.net/note/delete/83217/in+docs Del: other reasons-- https://master.php.net/note/delete/83217 Reject -- https://master.php.net/note/reject/83217 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#139415) next »