You are here: linking id fields between tables « PHP SQL « IT news, forums, messages
linking id fields between tables

Posted by google on 09/20/05 16:38

I am using MySQL to keep a database containing tables 'merchants' and
'products'.
My 'products' table has an auto-incrementing id for each record, other
fields, and a 'merchant' field. My 'merchant' table also has an
auto-incrementing id. Is this a candidate for a relationship between
the two ? At present, I use phpMyAdmin to enter the text 'amazon.co.uk'
for the merchant.merchant field.
Should I have a php script which reads the user input 'amazon' and does
a SELECT query on 'merchants' to pull the id for 'amazon', then INSERT
it into a 'merchant_id' field in table 'products', thereby dispensing
with the word 'amazon' in the 'products' table in order to improve
efficiency ?

I am new to MySQL and am unclear about how far to separate data into
separate tables. For example, in a database of clothes, would it make
sense to have a table of 'colours','sizes','material' ? If this is the
case, then is the linking done through a html/php form which replaces
the word 'red' with the id for 'red' in the colours table ?

Thank you for any help....

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация