Thanks Peter.
So what is the logic behind foreign keys? Why use them?
Thx.
Karl
Sent from losPhone
On Apr 30, 2010, at 5:09 AM, Peter Lind <peter.e.lind@xxxxxxxxx> wrote:
On 30 April 2010 12:02, Karl DeSaulniers <karl@xxxxxxxxxxxxxxx> wrote:
Hello All,
I have a product database. In that database there are several
tables dealing
with individual products.
I am wanting to set up an editProduct and a productInfo page. For
the bulk
info, I am fine.
For the product options, I need some guidance.
I have 4 tables dealing with the options.
Product table = main product table where productID is set
Product Options table = table to store product option info. Where
productID,
optionID and OptionGroupID are stored together per ProductID.
Option Groups table = general option groups EG: Size, Color. Where
OptionGroupID and OptionGroupName is set.
Options table = general options EG: Large, Medium, Small, Red,
Blue, etc.
Where OptionID and OptionName is set per OptionGroupID.
Is there a way for me to call all these tables when adding a
product? edit
product? view product?
MySQL will only allow you to insert into one table at a time. You can
however update several tables at the same time - see
http://dev.mysql.com/doc/refman/5.0/en/update.html
You can select values form multiple tables with the SELECT syntax:
SELECT table1.blah, table2.blah FROM table1, table2 WHERE table1.id =
table2.foreign_key;
Regards
Peter
--
<hype>
WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
Flickr: http://www.flickr.com/photos/fake51
BeWelcome: Fake51
Couchsurfing: Fake51
</hype>
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php