note 84265 deleted from function.mysql-insert-id by cmb
| From: | cmb@php.net | Date: | Sun, 16 Feb 2020 13:24:52 +0000 |
| Subject: | note 84265 deleted from function.mysql-insert-id by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-214109@lists.php.net to get a copy of this message | ||
Note Submitter: thomas at tgohome dot com
----
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.