0
Good morning before, some doubts arose when I was developing the database of my online sales site (only for lesson context...). It is the following, I have the products table, then I have the cart, invoice and orders, in all of them I have to store the products, just add one more field in them where I store the product code ? or as we have another table linking them by having a relationship of many to many works otherwise? , I’m kind of confused...
so from what I understand, I have the products table with the product codes, being a user added to the cart, so I would have to create a field in the cart table for example "products", I would already have the products in the cart, I still didn’t realize what I meant by just pulling on the invoice code. thank you for answering me.
– PKyoshi
I was a bit confused, do the following, in the table create cart: products, there you will add the ID’s of the products, and in this cart also create the field: code_do_cart(or as you want), after paying the invoice, you only recover the code value of the cart and in select vc put: WHERE code_do_cart = $string
– Raphael Caldas
Or you can create a totally new table that has the fields: id|usuario|code_do_cart|product, and there you to each product q is added in the cart and then you pull: FROM table WHERE usuario = $user
– Raphael Caldas
Raphael caldas, effort to help me, I realized what you wanted to tell me and I already know how I’m going to do it. ;) , hug, have a good day.
– PKyoshi