I have a table in MySQL that for compatibility issues we assigned specific Primary Keys, therefore they can not be auto incremented.
Every time we insert a new topple (in PHP) we need to get back the latest ID inserted. It might sound stupid. but we do not generate the ID from PHP, it comes from an generic AJAX function, therefore we don’t know the name of the variable containing the Primary Key, it always changes.
Is there a way, using PHP or MYSQL, to obtain the latest ID inserted for a primary key that does not auto-increment?
Unfortunately mysql_insert_id() and last_insert_id() do not work without auto_increment.
Thanks!
Head down to the comments section on this page.
http://php.net/manual/en/function.mysql-insert-id.php
And you should see some methods that might work for you.
I would try inserting the specific time_stamp and then calling that time_stamp insert again.
Dave does a good job of explaining it in this comment. Quoting him..