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

  • Home
  • SEARCH
  • 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 3403320
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T05:14:49+00:00 2026-05-18T05:14:49+00:00

I am writing in PHP a mySQL query. I would like to duplicate a

  • 0

I am writing in PHP a mySQL query. I would like to duplicate a row in a table in the database. I would also like to insert a time stamp as to when that duplication happened with the NOW() function.

If I had a table named ‘people’ stuctured with the fields:

id, name, phone, dateCreated

and I wanted to duplicate this record I would do the following:

INSERT INTO people (id, name, phone, dateCreated)
SELECT id, name, phone, dateCreated 
FROM people 
WHERE id = '$id'

This will duplicate the record identified by the $id. I would like to do this same concept but instead of copying the dateCreated, I would like the query to insert the current datetime via the NOW() function but I am not sure how to structure this type of query.

Something like:

INSERT INTO people (id, name, phone)
SELECT id, name, phone
FROM people
WHERE id = '$id'
(dateCreated) value (NOW())

How would I structure the query?

  • 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-05-18T05:14:49+00:00Added an answer on May 18, 2026 at 5:14 am
    INSERT INTO people (id, name, phone, dateCreated)
    SELECT id, name, phone, NOW()
    FROM people 
    WHERE id = '$id'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a php app to access a MySQL database, and on a tutorial,
When it comes to writing custom MySQL database-driven PHP session management for a VERY
I'm writing a redirect script in PHP that will insert info about the click
I am writing an web application powered by PHP, Smarty, JavaScript, CSS, MySQL. There
I was writing a database handler class in PHP using the mysqli class and
I've been writing PHP web applications for some time, and have come across very
I'm writing a php-mysql application. The application allows the user to run a search
I have a php page that displays rows from a mysql db as a
i am writing a site from scratch using php/mysql and am using GET requests
I'm writng a small application in PHP + MySQL and have come to the

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.