php - Move from one table to another -
i need move data table archive table.
now way:
$sql = 'insert history_products select * products category_id='.$id;
and delete data products table.
$sql_delete = 'delete products category_id = '.$id;
each product have unique id. want make in secure way, if row isn't inserted in history_products row deleted products table. don't want delete if insert fails.
i expected have field called id (produktid), products must have same id in both tables then, following should work.
delete products products.id in (select history_products.id history_products)
Comments
Post a Comment