[wd_asp elements=’search’ ratio=’100%’ id=1]

Inserted row – Show last row inserted by Mysql

1st August 2014

MySql

mysql codehaven category

Maybe you want to know what was the last inserted record to the database. Add this straight after the MySQL statement.


$inserted_row_id = mysql_insert_id();

mysql_query("DELETE FROM reports WHERE id <> {$inserted_row_id} ") or die(mysql_error());

Laravel version is here