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 6608805
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:38:55+00:00 2026-05-25T19:38:55+00:00

Firstly please excuse my lack of knowledge for SQL, I have only done basic

  • 0

Firstly please excuse my lack of knowledge for SQL, I have only done basic inserts before.

I am currently improoving a little system that I have, and I want to insert some data that is obtained via _GET (php) into two tables. My problem is as follows.

My first table (table_one) has an auto incrementing value called “id”, which I need to obtain, and post over to my second table (table_two).

Because of the way data will be updated at the later date, the ID in table two, is a reference to the ID that is automatically generated upon insert in table one (hence no ID in the code below). (I will be using the ID in table one to do a for loop for each matching ID instance in table_two)

How can I run one query to update one table, then update the 2nd with the unique id obtained from the first table?

My current code is this…

INSERT INTO table_one (valueone,valuetwo,valuethee) VALUES ('$v1','$v2','$v3')
  • 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-25T19:38:56+00:00Added an answer on May 25, 2026 at 7:38 pm

    you can use mysql_insert_id() built in command of php this will give you the id of the recently inserted data

    mysql_query("insert into.... ");
    $a = mysql_insert_id();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

firstly please excuse my relative inexperience with Hibernate I’ve only really been using it
Firstly, I'm totally javascript inept so please explain throughly. OK, I have two issues
Firstly please understand that SQL is not one of my strong areas at the
Firstly could someone please be kind enough to comment on why Microsoft might have
Firstly, let me set out what I'd like to do. Assume I have three
Please understand firstly that I fully understand that Java will return a String when
Firstly, please don't move to serverfault. It is indeed a programming question :-) We
Firstly, please go to this url: celebritywallpaperbase picture #1 is Drew Barrymore smile picture
Firstly this has turned out to be quite a long post so please bear
Firstly, how can I have jQuery continuously check the time, and add an id

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.