php – Display data from two tables in grid with YII framework



I'm starting how to develop web and I have a problem working with the YII framework 1.

I have a grid in the application that displays: product name, segment, price . All of this data comes from the database in two customer and product tables. The problem is that the grid lists all these items from all registered customers. I have to make the grid display only the products, segment, price of the customer logged in, and not all.

Tabela_cliente (cod_cliente(PK), nome_cliente,end_cliente)
Tabela_produto(cod_produto(PK),segmento, preço)

I don't know if you have to create a produto_cliente table, where to check to enter the data in the grid.

I can't show any code because the company doesn't allow it for contract reasons.

Does anyone help? I know it must be a relationship thing but where do I do this in my code?


What is the relationship between products and customers? Because a many-to-many relationship needs an auxiliary table (customer_product), but if it's a one-to-many relationship, you can resolve it with a foreign key.

Scroll to Top