I am using
mysql_query("INSERT INTO imaegs_backup SELECT * FROM images");
in order to copy the information for the images table to the images_backup table. On the images table I have:
id name link
1 name1 www.aaa.com/1
2 name2 www.aaa.com/2
3 name3 www.aaa.com/3
5 name5 www.aaa.com/5
as you can see id number 4 is missing from the images table. and when I am coping the tables I am getting the same result in table images_backup(which is expected). How can I copy the images table to the images_backup and I want the result to be something like this:
id name link
1 name1 www.aaa.com/1
2 name2 www.aaa.com/2
3 name3 www.aaa.com/3
4 name5 www.aaa.com/5
as you can see in row 4 there is name5 and link to image 5.
Note: the id column is set to auto increment, but I can change that.
If the table you’re inserting into has an auto-incrementing ID, then just specify two columns; the auto-incrementing field will take care of the value itself: