note 84265 added to function.mysql-insert-id
| From: | thomas at tgohome dot com | Date: | Sun, 06 Jul 2008 20:47:35 +0000 |
| Subject: | note 84265 added to function.mysql-insert-id | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-141218@lists.php.net to get a copy of this message | ||
Be careful, because this operates on the last performed query, it includes UPDATEs and SELECTs as
'queries'. For example, this is what I set up.
INSERT post into database
UPDATE child forums with insert ID (insert ID is correct)
Insert ID = 0 because of last query
Send the user to their post - but fail because the insert ID is zero.
So store it in a variable like $insert_id instead of querying it every time.
----
Server IP: 92.48.100.16
Probable Submitter: 78.146.104.109
----
Manual Page -- http://www.php.net/manual/en/function.mysql-insert-id.php
Edit -- https://master.php.net/note/edit/84265
Del: integrated -- https://master.php.net/note/delete/84265/integrated
Del: useless -- https://master.php.net/note/delete/84265/useless
Del: bad code -- https://master.php.net/note/delete/84265/bad+code
Del: spam -- https://master.php.net/note/delete/84265/spam
Del: non-english -- https://master.php.net/note/delete/84265/non-english
Del: in docs -- https://master.php.net/note/delete/84265/in+docs
Del: other reasons-- https://master.php.net/note/delete/84265
Reject -- https://master.php.net/note/reject/84265
Search -- https://master.php.net/manage/user-notes.php