1. Build a table :
CREATE TABLE ' orders ' (' oid ' int (one) not NULL auto_increment, ' total ' double DEFAULT NULL, ' Ordertime ' datetime defaul T null, ' state ' int (one) default null, ' name ' varchar () default NULL, ' addr ' varchar (+) default NULL, ' phone ' varch AR () default null, ' UID ' int (one) default NULL, PRIMARY key (' oid '), key ' fkc3df62e5aa3d9c7 ' (' uid '), CONSTRAINT ' FKC 3df62e5aa3d9c7 ' FOREIGN KEY (' uid ') REFERENCES ' user ' (' uid ')) Engine=innodb auto_increment=2 DEFAULT Charset=utf8; CREATE TABLE ' orderitem ' (' itemid ' int (one) not null auto_increment, ' count ' int (one) DEFAULT NULL, ' subtotal ' double DE FAULT null, ' pid ' int (one) default null, ' OID ' int (one) default NULL, PRIMARY key (' itemid '), key ' fke8b2ab6166c01961 ' ( ' OID '), key ' Fke8b2ab6171db7ae4 ' (' pid '), CONSTRAINT ' fke8b2ab6166c01961 ' FOREIGN KEY (' oid ') REFERENCES ' orders ' (' oid ') ), CONSTRAINT ' Fke8b2ab6171db7ae4 ' FOREIGN KEY (' pid ') REFERENCES ' product ' (' pid ')) Engine=innodb auto_increment=2 Defau LT Charset=utf8;
Online Mall 7--Order module