Display data from two grid tables with YII framework

Asked

Viewed 90 times

3

Hello,

I’m starting how to develop web and I’m having a problem working with YII framework 1.

I have in the application a grid that displays: product name, segment, price. All these data come from the database in two tables client and products. The problem is that the grid lists all these items from all registered clients. I have to make the grid display only the products, segment, customer’s price 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 table produto_cliente, where to do this check to enter the data in the grid.

I can’t show any code because the company won’t allow it for contract reasons.

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

1 answer

0

What is the relationship between products and customers? Because a relationship many to many needs an auxiliary table (product), but if it is a relationship like one for many you can solve with a foreign key.

  • I created the auxiliary table and solved with INNER Join .

Browser other questions tagged

You are not signed in. Login or sign up in order to post.