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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:46:38+00:00 2026-05-26T03:46:38+00:00

I am trying to do 3 simultaneous inserts into 3 tables as the user

  • 0

I am trying to do 3 simultaneous inserts into 3 tables as the user registers to my site.
Here are my tables:

UPDATED ANSWER. simplified the question:

Table 1

 ControlPanelID
 UserDescription
 ChannelCommentsID  
 UserID

Table 2

UserID
UserName
Password
Email
Reputation
ControlPanelID
Role

Here are my 3 insert Statements:

$queryString=
            "INSERT INTO ControlPanel VALUES("",ChannelCommentsID , userID)".
            "INSERT INTO users VALUES($userNam,$pass,$email, ,'anonym')";

I want the UserID row to increment in both tables..how is that being acheived?

in other words opening the connection to the database twice… (i.e. 2 queries)?

  • 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-26T03:46:39+00:00Added an answer on May 26, 2026 at 3:46 am

    You may use LAST_INSERT_ID() to get the value of the AUTOINCREMENT column for the previous INSERT.

    In your specific case, this may be a possible solution

    $queryString=
        "INSERT INTO users VALUES($userNam,$pass,$email, ,'anomy')".
        "INSERT INTO ControlPanel VALUES("",ChannelCommentsID , LAST_INSERT_ID())";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to make a MySQL-based application support MS SQL, I ran into the following
I'm trying to use ajax to make multiple simultaneous requests to a php script,
I re-asked this question here because the people at ServerFault deemed that this is
Im trying to follow this article for having simultaneous pan and pinch gesture recognizers
I am trying to prevent multiple simultaneous logins in my web application. I want
I'm trying to develop an application where simultaneous users can interact and i need
TCP standard has simultaneous open feature. The implication of the feature, client trying to
What I'm trying to do is make some action happen when two simultaneous image
How do I handle simultaneous key presses in Java? I'm trying to write a
This is the question I'm trying to solve: The following divide-and-conquer algorithm is proposed

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.