Jump to content

Question regarding auto_increment ID and reference tables


Recommended Posts

Hi guys, I have a system that does quotes for jobs for customers. The user inputs a customer's information and then the options they want on their building and it stores the quote in the database into a quote table. I have some questions regarding the best way to do this:

1. Should I enter the customer ID into the quote table or enter the quote ID into the customer table for reference?

2. Either way, how do I get that ID to enter into the reference table? I have the primary key ID set to auto_increment for both tables, how do I know what the ID is going to be so I can store it in the other table?

3. What's the best way to perform both of these SQL statements but not commit them until everything is okay?

 

Thanks.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.