Home >Backend Development >PHP Tutorial >How to make order details table and order table?

How to make order details table and order table?

WBOY
WBOYOriginal
2016-09-08 08:43:595210browse

detail order details table
Field name data type default value allows non-empty auto-increment remarks
id int(11) NO is the id
orderid int(11) NO order id number
goodsid int(11) NO product id number
name varchar (32) NO Product name
prince double(6,2) NO Unit price
num int(11) NO Quantity

orders order table
field name data type default value allows non-empty auto-increment remarks
id int(11) NO is id
uid int(11) NO member id number
linkman varchar(32) NO contact person
address varchar(255 ) NO address
code char(6) NO zip code
phone varchar(16) NO phone number
addtime int(11) NO purchase time
total double(8,2) NO total amount
status tinyint(4) NO status 0: new Order 1: Shipped 2: Received 3: Invalid order

Shopping cart settlement, how to obtain the ordersid in the detail order details table?

Reply content:

detail order details table
Field name data type default value allows non-empty auto-increment remarks
id int(11) NO is the id
orderid int(11) NO order id number
goodsid int(11) NO product id number
name varchar (32) NO Product name
prince double(6,2) NO Unit price
num int(11) NO Quantity

orders order table
field name data type default value allows non-empty auto-increment remarks
id int(11) NO is id
uid int(11) NO member id number
linkman varchar(32) NO contact person
address varchar(255 ) NO address
code char(6) NO zip code
phone varchar(16) NO phone number
addtime int(11) NO purchase time
total double(8,2) NO total amount
status tinyint(4) NO status 0: new Order 1: Shipped 2: Received 3: Invalid order

Shopping cart settlement, how to obtain the ordersid in the detail order details table?

When placing an order, it is transaction processing. First, insert the orders table, then get the ordersid just inserted, and then insert it into the detail table.

If insertion fails, rollback

ecshop has a special cart table specifically for shopping cart information. When you click to add to the shopping cart, put the session or userid + product ID into the shopping cart. When checking out, just submit it as a normal form.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn