LAST_INSERT_ID() MySQL

You could store the last insert id in a variable : Or get the max id from table1 (EDIT: Warning. See note in comments from Rob Starling about possible errors from race conditions when using the max id) (Warning: as Rob Starling points out in the

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)