Database for E-commerce site

Asked

Viewed 1,610 times

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...

inserir a descrição da imagem aqui

1 answer

0


You can make a table with product codes that refer to a specific id and then in the cart you pull these ids and put there, and in the invoice you pull the invoice code only. NOTE: Be careful when pulling to not have string conflict!

  • 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.

  • 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

  • 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, 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.

Browser other questions tagged

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