php - problem in many to many relationship -
i have 2 tables jewelry(j_id,j_name,description)
, style(style_id,style_name,image)
each table has many many relationship other table, 1 jewelry product can have multiple styles , there more product of same style, relationship many many.
now question how can relate these tables i.e want insert single record in jewelry table , there should multiple styles 1 jewelry product.
on jewelry html page want put style in multiple select dropdown list populated dynamically style table , if user want select 2 style same product, can.
i recommend 4 tables, 3 jewellery , style , fourth 1 orders.
jewellery : jid (pkey),jname,description
style: sid (pkey), sname, description
product : pid (pkey), sid(fkey), jid(fkey) - 1 product defines unique combination of style , kewellery
order : oid(pkey), pid(fkey), other details(name, address etc.)
for each jewellery, recover associated styles using product table , populate fields on html page. each order, store product id, uniquely identifies both jewellery , style.
Comments
Post a Comment