Can we simply duplicate an entry in the database based on it’s ID without having to mention all the field names for that row to be duplicated.
I have a row that looks like
id name last city state whatever
1 joe doe xyz NY yyy
I would like to make a duplicate. id is auto increment. What is the easiest way to do this.
Based on your comment on @Adam Wenger’s answer, I would just read all fields in one query and then build a new query skipping the
idfield.Something like:
php:
By the way, I would generate a prepared statement in PDO for both queries so that I would not have to worry about escaping the data.