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

Update then delete old record – Allow only 1 entry

16th April 2014

MySql

mysql codehaven category

Add code below straight after the last MySQL insert data statement.
This passes the id number of that row to $inserted_row_id
Then it deletes all you want, but that id number.

$inserted_row_id = mysql_insert_id();
$todayDate = date('Y-m-d');
mysql_query("DELETE FROM table1 WHERE id <> {$inserted_row_id} AND date = '{$todayDate}' AND campaignid = '{$databaseRow['campaignid']}'") or die(mysql_error());