On form post the certain rows need to be deleted or new rows need to be inserted into database (mysql).
What I have:
$toInsert = array() // array of ID's where new rows need to be created because these ID's dont exist in any row.
$toDelete = array() // array of ID's where rows containing this ID need to be deleted.
Delete sql query:
$sql = DELETE FROM table WHERE id IN ' . implode(',',$toDelete);
Query deletes all rows containing this ID. How can I do the same thing but with insert? Certain default values need to be inserted alongside with the ID itself.
Your suggestions or criticism are very much appreciated.