Quantcast
Channel: Yii Framework Forum
Viewing all articles
Browse latest Browse all 18717

Dropdownlist

$
0
0
Hi,
I'm new to Yii, I'm trying to create a DropDownList between two Tables: Category and Product.

Category Table:

create table category (
id integer not null primary key auto_increment,
name varchar(256) not null
)
engine = InnoDB;


Product Table:

create table product (
id integer not null primary key auto_increment,
name varchar(256) not null
)
engine = InnoDB;


Category and Product Assignment:

create table category_product_assignment (
category_id int(11) not null,
product_id int(11) not null,
primary key (category_id, product_id) 
) 
engine = InnoDB;

alter table category_product_assignment
add constraint FK_category_product 
foreign key (category_id)
references category(id)
on delete cascade
on update restrict;

alter table category_product_assignment
add constraint FK_product_category
foreign key (product_id)
references product(id)
on delete cascade
on update restrict;


My question is:
How can I insert a DropDownList into the views/product/_form.php that have an array of Categories?
Thanks in advance for your time

Viewing all articles
Browse latest Browse all 18717

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>