M
M
Max Ba2018-07-02 16:53:58
PHP
Max Ba, 2018-07-02 16:53:58

How to connect Class data correctly?

I have a theoretical question.
There are three classes:
- Customer User
- Order Orders
- Product Product
On the site you need to display a table that will display information about the Order, the User's contacts and the name of the Product. The table of orders itself contains only id_user, id_product (inside the database, everything is connected by foreign keys)
It turns out that I need to display a list of all orders in an array
By id_user, display a list of all customers
By id_product, display a list of all goods
Connect the received in php and output as you like?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
ThunderCat, 2018-07-02
@ThunderCat

3 tables are united through join on the corresponding keys, the resulting set is already stuffed into objects. Otherwise, it will turn out to be too large a sample size and an incomprehensible order, yet a database is more suitable for this than sorting in PHP.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question