Re: [PHP-DB] grabbing from multiple tables

2010-05-01 Thread Karl DeSaulniers
@Peter To be honest, this is my first one. So the margin for error is probably there, I just cant see it. BUT, I did get this database file pre-made from WebAssist. Its their E-Commerce database file they gave out. (Sorry if I am repeating myself) So the structure was set up by another and I am

Re: [PHP-DB] grabbing from multiple tables

2010-05-01 Thread Karl DeSaulniers
GOLD! Thank you. Karl On May 1, 2010, at 4:12 AM, Peter Lind wrote: On 1 May 2010 11:00, Karl DeSaulniers wrote: Thank you Peter... again.. :) Which would be the source field and which the target field? You place the constraint on the table that has the foreign key. Using your example: T

Re: [PHP-DB] grabbing from multiple tables

2010-05-01 Thread Peter Lind
On 1 May 2010 11:00, Karl DeSaulniers wrote: > Thank you Peter... again.. :) > Which would be the source field and which the target field? You place the constraint on the table that has the foreign key. Using your example: Table 1 = products * id = primary key Table 2 = productoptions * product

Re: [PHP-DB] grabbing from multiple tables

2010-05-01 Thread Karl DeSaulniers
Thank you Peter... again.. :) Which would be the source field and which the target field? Karl On May 1, 2010, at 3:22 AM, Peter Lind wrote: On 30 April 2010 20:49, Karl DeSaulniers wrote: No, please confuse me. I need to know this stuff. @Peter thanks for that introduction to foreign keys

Re: [PHP-DB] grabbing from multiple tables

2010-05-01 Thread Peter Lind
On 1 May 2010 10:13, Karl DeSaulniers wrote: > What is the SQL query I can use to get an item that has two IDs? > Something to the effect of... > > $q = "SELECT OptID = '$OptID' FROM ".PRODUCT_OPTIONS." WHERE ProdID = > '$ProdID' AND OptGrpID='$OptGrpID'"; Close but no cigar. $q = "SELECT OptID

Re: [PHP-DB] grabbing from multiple tables

2010-05-01 Thread Peter Lind
On 30 April 2010 20:49, Karl DeSaulniers wrote: > No, please confuse me. I need to know this stuff. > > @Peter thanks for that introduction to foreign keys. Since my productoptions > table is based off of items in products, optionGroups and options, would I > use foreign keys for this? If I read

Re: [PHP-DB] grabbing from multiple tables

2010-05-01 Thread Karl DeSaulniers
l On Apr 30, 2010, at 2:59 PM, David Murphy wrote: -Original Message- From: Karl DeSaulniers [mailto:k...@designdrumm.com] Sent: Friday, April 30, 2010 1:50 PM To: php-db@lists.php.net Subject: Re: [PHP-DB] grabbing from multiple tables No, please confuse me. I need to know this stuf

Re: [PHP-DB] grabbing from multiple tables

2010-04-30 Thread Karl DeSaulniers
.. :) Karl On Apr 30, 2010, at 2:59 PM, David Murphy wrote: -Original Message- From: Karl DeSaulniers [mailto:k...@designdrumm.com] Sent: Friday, April 30, 2010 1:50 PM To: php-db@lists.php.net Subject: Re: [PHP-DB] grabbing from multiple tables No, please confuse me. I need to know

Re: [PHP-DB] grabbing from multiple tables

2010-04-30 Thread Karl DeSaulniers
, 2010, at 2:59 PM, David Murphy wrote: -Original Message- From: Karl DeSaulniers [mailto:k...@designdrumm.com] Sent: Friday, April 30, 2010 1:50 PM To: php-db@lists.php.net Subject: Re: [PHP-DB] grabbing from multiple tables No, please confuse me. I need to know this stuff. @Peter

Re: [PHP-DB] grabbing from multiple tables

2010-04-30 Thread Karl DeSaulniers
d you will be fine. Check for the right syntax and don't complicate more. He said he is quite new, so discuss about foreign keys will only confuse him. Use JOIN and pure SQL and you will be fine. Cheers DZvonko --- On Fri, 4/30/10, Peter Lind wrote: From: Peter Lind Subject: Re: [PHP-DB

Re: [PHP-DB] grabbing from multiple tables

2010-04-30 Thread Peter Lind
On 30 April 2010 13:41, DZvonko Nikolov wrote: > > Hi, > > don't confuse the guy. Don't talk down to the man. He asked questions and got usable answers including links to where he could find more info. -- WWW: http://plphp.dk / http://plind.dk LinkedIn: http://www.linkedin.com/in/plind Flickr:

Re: [PHP-DB] grabbing from multiple tables

2010-04-30 Thread Peter Lind
On 30 April 2010 12:26, Karl DeSaulniers wrote: > Thanks Peter. > So what is the logic behind foreign keys? Why use them? Constraints. When using, for example, the InnoDB engine in MySQL, you can set foreign key fields on tables. These ensure that your record will always be bound to a proper reco

Re: [PHP-DB] grabbing from multiple tables

2010-04-30 Thread Karl DeSaulniers
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 wrote: On 30 April 2010 12:02, Karl DeSaulniers wrote: Hello All, I have a product database. In that database there are several tables dealing with

Re: [PHP-DB] grabbing from multiple tables

2010-04-30 Thread Peter Lind
On 30 April 2010 12:02, Karl DeSaulniers 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

[PHP-DB] grabbing from multiple tables

2010-04-30 Thread Karl DeSaulniers
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 option