It’s simple to get the ID of the last record you inserted using MySQL and PHP. You can always see how many records you’ve inserted thanks to this feature. The quickest approach to acquire the ID of the last entry while using MySQLi procedural connection is to use the mysql insert id () statement.