php - How to effectivelly attach value to references table id? -
i have table "products" website. there product_id, image , bunch of information manufacturer, health, age etc. when started work on projekts chose save enums this:
manufacturer enum('manufacturer1', 'manufacturer2', 'manufacturer3', 'manufacturer4'),
however dealing more stuff have realized not best approach me. decided create reference tables. manufacturer looks this:
create table manufacturer( manufacturer_id int(10) unsigned not null auto_increment, name varchar(50) not null, primary key (manufacturer_id ), unique index name (name) );
but in products table have:
manufacturer_id int(10),
the question on best way assign value reference table. using ci framework , easy display product in view. when run query product "3" instead of "manufacturer3".
i use join have 7 joins. created library function ataches value. have save possible values in function or query every reference table every time use library.
i mean there lot of articles why not use enums , - run in problems enum in project myself. dont how convert reference ids real value (efectivelly, dont think 7 joins way if have often)
Comments
Post a Comment