Now that we’ve created the backup table it’s simply a matter of running a INSERT INTO … SELECT query to copy the data from the original table into the copy:
INSERT INTO products_bak SELECT * FROM products
Copying the data back again
If something went wrong with your original table after you’ve been mucking around with it, you can then simply delete the data from the original table using TRUNCATE and then use the same query above to copy it back again:
TRUNCATE products; INSERT INTO products SELECT * FROM products_bak
This entry was posted in PHP (Hyper Text Preprocessor) and tagged Copying the data from the original table to the new table.