Tag Archives: mysql

How To Get The Last MySQL Auto-ID in PHP

There will be times when you will need to retrieve the last auto id on a table where you just did an insert. They way to do this is as follows: <?php $link = mysql_connect(‘host’, ‘user’, ‘pass’); if(!$link) { die(‘could not connect: ‘. mysql_error() ) ; } mysql_query(“INSERT INTO table (field) values (‘val1′)” ); echo [...]