How to delete a piece of data and insert this data into another one is shown in two tables: sns_topic and sns_topic_del. edit the data on the list page of the sns_topic table, you need to delete a piece of data and insert it into the sns_topic_del table. how can this problem be solved ?, Execute two queries. first INSERT and then DELETE. make sure that you DELETE a data record and INSERT it into another table.
Now there are two sns_topic and sns_topic_del tables. you can edit the sns_topic on the list page of the sns_topic table. you need to delete a piece of data and insert it into the sns_topic_del table. how can this problem be solved?
------ Solution --------------------
Execute two queries: INSERT and DELETE. to ensure data consistency, you must use the statement as a transaction.
------ Solution --------------------
Create a trigger in the database!
------ Solution --------------------
PHP code
Mysql_query ("start transaction"); $ sql1 = mysql_query ('Insert statement'); $ sql2 = mysql_query ('delete statement'); if ($ sql1 & $ sql2) {// submit mysql_query ('commit ');} else {// transaction ROLLBACK mysql_query ('rollback');} mysql_query ('end ');