In certain cases you may need to get the I.D. of the last record that was inserted or updated into your
database we can do that using the Get last I.D..
Function we can implement this function in our last script by inserting the following syntax
in our if statement.
We've stored the value of the last I.D. in this variable we can then output the Variable value in an
echo statement so we'll modify our echo statement to look like this
so if the record was successfully created we'll get a statement new record created successfully record.
I.D. is and then they'll output the value of the last I.D..
So let's test the script to make sure it works.
Save the file.
I'm just gonna reload the form and enter some information
so we can see them.
The messages popped up and the record I.D. is 32 so we can verify that in our database.
So I pulled up the table in HP my admin and I'm going to click refresh so we can see that the last record
was entered successfully and the I.D. is in fact 30 to.