Currently working on a webshop and have been running in to some noob problems.
So i have three tables that i need to pull some data out of. One table stores the suppliers, the other one orders and the third ordered products. It looks something like this:
::: Table: suppliers supplier_id supplier_name supplier_email ::: Table: orders order_id customer_id order_date ::: Table: orderitems id order_id product_id product_name product_qty supplier_id
My goal is to send a mail to each supplier containing the list of products that has been ordered with their supplier id in it.
The only thing i could think of was doing some kind of query inside a foreach, but that seems to be bad practice...right?
I want to start off by using the order_id and then track my way down to each supplier list.
Anyone that could give me some pointers on how to get there?