Jump to content

Need two Unique Identifiers


aprillougheed

Recommended Posts

I\'m sure this question has been asked before, but I couldn\'t find the answer.

 

I\'m running an online form for an irrigation company. We have a form that uses PHP to write to MySql.

 

I\'d like to have an auto-incremented unique \"row\" id and

I\'d like to have an auto-incremented unique \"customer\" id.

 

When a new customer registers, their information is posted to two different tables. I\'d like the unique Customer ID to post to both tables.

 

If I understand how this works . . . I should then be able to query Table A and Table B for Customer ID XXX - and the script will pull some data from Table A and some data from Table B for Customer ID XXX. Does this make sense?

 

So I\'m not sure if PHP should/can assign a unique CustomerID or if it will be MySQL ???

 

I\'ve got six books on PHP/MySQL and I can\'t find one that tells me how to do this -- can you believe it?

 

Hey, this is a cool forum. Glad I found you guys. PHP is addicting isn\'t it?

Link to comment
Share on other sites

Learn more about Foreign key

 

A small definition

A foreign key, also called a foreign keyword, in a database table is a key from another table that refers to (or targets) a specific key, usually the primary key , in the table being used. A primary key can be targeted by multiple foreign keys from other tables. But a primary key does not necessarily have to be the target of any foreign keys.  

It is possible to change the primary key in a table when the specific needs of the users change. For example, the people in a town might be uniquely identified according to their driver license numbers in one application, but in another situation it might be more convenient to identify them according to their telephone numbers. When the primary key in a table is changed, the set of associated foreign keys, if there are any, often changes as a result.

Link to comment
Share on other sites

Thank you for the lead.

 

Did you find that at php.net or MySql.com? Elsewhere?

 

I\'m always irritated by people who ask questions before they check the manual themselves.

 

I did check the manual(s), but I didn\'t search for \"foreign key\" - so I\'ll go back and look again.

 

Appreciate your help.

 

April

Link to comment
Share on other sites

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.