I am working on an events calendar using PHP and MySQL (V5.1) where the admin would add an event, and then an attendance list for that event would be created as well. I have
A couple of important points. First, if you getting your last insert ID you should execute LOCK and UNLOCK queries first:
events WRITE; Second, you can use the mysqli_insert_id() method to get the ID of the last insert. This means that you must have an AUTO_INCREMENT field in the table you are inserting.