I am trying to insert 2 rows into the same table. The first will input data from a select, the second will use vars for data. I am able to insert the first row but having trouble inserting multiple rows.
The $partner_id is to link the rows to each other. For this im using a generated 32char value in php. Is there anyway to set the edit_partner_id with mysql as the id of the first row inserted or is this not possible due to the first row has to be created before you can get the last id?
Is it possible to also add an update to this or would I have to run this in a seperate query?
$sql = "INSERT INTO edits_customers (customer_id, creator_id, firstname, surname,
house_no, address_1, address_2, address_3, city, county, postcode,
country, email, home_tel, mobile_tel, work_tel, notes, edit_type,
edit_partner_id )
(SELECT *, 'before', '{$partner_id}' FROM customers WHERE customers.id = 123),
('{$var1}', '{$var2}', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
'', 'after', $partner_id)";
Thanks