Created
September 6, 2015 21:32
-
-
Save vhdm/7425ec813ee9723ae736 to your computer and use it in GitHub Desktop.
Get last inserted id
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Insert into database | |
mysql_query("INSERT INTO my_table (`column1`, `column2`) VALUES ('one', 'two')"); | |
// Next Get what the auto incremented number was that was inserted | |
$id = mysql_insert_id(); | |
// Display it... | |
echo $id; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment