Re: Avoiding Multiple IDs
| From: | Hugh Bothwell | Date: | Thu, 02 Aug 2001 02:33:14 +0000 |
| Subject: | Re: Avoiding Multiple IDs | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-10983@lists.php.net to get a copy of this message | ||
"Steve Fitzgerald" <sf@mnetsys.com> wrote in message
news:20010801203243.98960.qmail@pb1.pair.com...
> What is the best method for avoiding multiple ids for the same
information.
>
> For example: I have a table name company that has unique ids. The
CompanyID
> are tied to a table name contacts which have unique ids (ContactID). The
> problem seems to be that if I add a contact with an existing CompanyName
> then I will get multiple ids for the same CompanyName.
When inserting a new contact, do a search for the company name. If it
exists,
use the existing id; otherwise, create a new company and get the new id.