note 68987 added to function.pdo-lastinsertid

From: Date: Fri, 18 Aug 2006 12:34:51 +0000
Subject: note 68987 added to function.pdo-lastinsertid
Groups: php.notes 
Request: Send a blank email to php-notes+get-116046@lists.php.net to get a copy of this message
in case anyone was wondering something like $val = 5; $sql = "REPLACE table (column) VALUES (:val)"; $stmt = $dbh->prepare($sql); $stmt->bindParam(':val', $val, PDO::PARAM_INT); $stmt->execute(); $lastId = $dbh->lastInsertId(); will return the last inserted id, whether the record was replaced or simply inserted the REPLACE syntax, simply inserts, or deletes > inserts so lastInsertId() still works refer to http://mysql.com/doc/refman/5.0/en/replace.html for REPLACE usage ---- Server IP: 203.220.0.234 Probable Submitter: 210.49.203.71 ---- X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/function.pdo-lastinsertid.php Edit -- https://master.php.net/note/edit/68987 Del: integrated -- https://master.php.net/note/delete/68987/integrated Del: useless -- https://master.php.net/note/delete/68987/useless Del: bad code -- https://master.php.net/note/delete/68987/bad+code Del: spam -- https://master.php.net/note/delete/68987/spam Del: non-english -- https://master.php.net/note/delete/68987/non-english Del: in docs -- https://master.php.net/note/delete/68987/in+docs Del: other reasons-- https://master.php.net/note/delete/68987 Reject -- https://master.php.net/note/reject/68987 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#116046) next »