I have the following MySQLi code for inserting column data from one table to another which is working absolutely fine. However what I would like it to do is to insert the column data only if it doesn't already exist in the check_in table. My code is as follows:
$insertInvRoom = $db->prepare("INSERT checkin_rooms (checkin_inventory_id, checkin_room_name, checkin_inventory_room_id) SELECT inventory_id, inventory_room_name, inventory_room_id FROM inventory_rooms WHERE inventory_id = ?");
$insertInvRoom->bind_param("i", $inventoryID[$key]);
$insertInvRoom->execute();
$insertInvRoom->close();
How can I do this?