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

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -