Jump to content

Archived

This topic is now archived and is closed to further replies.

aprillougheed

Need two Unique Identifiers

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?

Share this post


Link to post
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.

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

×

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.