note 118379 deleted from function.mysql-insert-id by cmb
| From: | cmb@php.net | Date: | Sun, 16 Feb 2020 13:32:15 +0000 |
| Subject: | note 118379 deleted from function.mysql-insert-id by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-214120@lists.php.net to get a copy of this message | ||
Note Submitter: stefaniosouza at gmail dot com
----
You can create a extra collum like with name "key" and generate this "key" using
date() function:
$key = date("Y-m-d H:i:s:u");
Then do the INSERT
"INSERT into 'table' ('col_1', 'col_2', 'key') values
('value 1', 'value 2', '$key')";
And now, you can SELECT the last ID
"SELECT ID from 'table' where key = '$key'";