help with relations


i have table category

id, name

and table products

id, categoryid, ...

how could i do that relation? (Products with his category)

If you have the db already set up use gii and it will do it for you. It will generate a HAS_MANY but change to HAS_ONE if need be.

Gii will create those relationships, only in case on InnoDb table, where those foreigner keys are defined.

In case of MyIsam MySql database, releationships will not be generated(must be generated manually). For this case, check this article

thanks that help-me alot!