I want to show the last login id from the database in view > _form.php file.I have made the code in _form.php file like this
All the last_insert_id functions (be they PHP wrappers or the native mySQL one) typically refer to the last ID created using the current database connection. The last login was probably not created during the same request you are showing the table in, so this method won't work for you.
Use a normal SELECT to find out the newest login instead - e.g. by using ORDER by creationtime DESC LIMIT 1.
Related: How to get a highest field value in a table in MySQL?