Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8097389
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T21:44:49+00:00 2026-06-05T21:44:49+00:00

I am using mysql_query(INSERT INTO imaegs_backup SELECT * FROM images); in order to copy

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T21:44:52+00:00Added an answer on June 5, 2026 at 9:44 pm

    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:

    INSERT INTO images_backup (name, link) 
    SELECT name, link FROM images ORDER BY id
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

in PHP, I'm using mysql_query($querystring) to insert some information into a table. However, when
Am saving to a mysql table using: $query = mysql_query(INSERT INTO test SET postit='$postit',postdate=NOW());
I am using a PHP mySQL query. Struggling with a Joins. mysql_query(SELECT * FROM
I want to insert / update data into a MySQL table by using a
Simple php/mysql INSERT such as mysql_query(INSERT INTO dispatch VALUES('1234','$name','$address')); intermittently fails. I've set it
just doing an INSERT using mySQL which works fine... mysql_query(INSERT INTO FLIGHTS_AVAILABLE (aircraftID, aircraftType,
I'm using the MySQL statement INSERT INTO to insert data into my table. I
I have a mysql statement like this: mysql_query(INSERT INTO movies (comments, description, synopsis) VALUES
I am trying to update customers information using a mysql query. The variables have
I am parsing an XML feed into a MYSQL table using simplexml_load_file(). Some of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.