note 110977 added to pdo.lastinsertid

From: Date: Wed, 02 Jan 2013 02:34:31 +0000
Subject: note 110977 added to pdo.lastinsertid
Groups: php.notes 
Request: Send a blank email to php-notes+get-192728@lists.php.net to get a copy of this message
Easiest solution I've found for MSSQL to obtain the last inserted ID is $STH = $DBH->query("SELECT CAST(COALESCE(SCOPE_IDENTITY(), @@IDENTITY) AS int)"); $STH->execute(); $result = $STH->fetch(); print $result[0]; from this link http://www.yiiframework.com/forum/index.php/topic/24275-solved-sql-server-2008-returning-blank-lastinsertid/ Looks like it is also possible to update the framework file too so that the function lastInsertId works. ---- Server IP: 69.147.83.199 Probable Submitter: 85.204.9.1 ---- Manual Page -- http://php.net/manual/en/pdo.lastinsertid.php Edit -- https://master.php.net/note/edit/110977 Del: integrated -- https://master.php.net/note/delete/110977/integrated Del: useless -- https://master.php.net/note/delete/110977/useless Del: bad code -- https://master.php.net/note/delete/110977/bad+code Del: spam -- https://master.php.net/note/delete/110977/spam Del: non-english -- https://master.php.net/note/delete/110977/non-english Del: in docs -- https://master.php.net/note/delete/110977/in+docs Del: other reasons-- https://master.php.net/note/delete/110977 Reject -- https://master.php.net/note/reject/110977 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#192728) next »