This topic is locked

how to set up 1:1 relation

10/24/2012 4:50:56 AM
PHPRunner General questions
S
simonfunk author

Hello
i have a products and options. in options you an choose several values like color, speed etc.

the tables look so:
---products---

id

name

description
---options---

id

product_id

color

speed

format
now i wanna that i can add options by add new product, but when i make a master->details relation i can add several options but it should only add the options once. how can i add this?

W
wildwally 10/24/2012

Sounds like this is the way you have things set up not a relationship issue.
After you add the single option you should redirect the user so that another option can not be entered. Unless I'm misunderstanding your problem.

Sergey Kornilov admin 10/24/2012

If your relationship is 1:1 you are in fact only have one entity and database theory suggests having a single table for this purposes.