2. Tables, folder and files
• 3 Tables(Orders, Orders_detail and Products)
• Folder img for store all picture
• Product.php for show all product
• Order.php for receive order
• Show.php for show data in cart
• Delete.php for delete data from cart
• Checkout.php for submit data
• Save_checkout.php for save all data into table
• Clear.php for clear all data from cart
• Cal_p.php for increase order qty in cart
• Cal_m.php for decrease order qty from cart
• Finish_order.php for show message transaction finish
• View_order for preview invoice
• And include.php for connect database
3. CREATE TABLE Orders
CREATE TABLE `orders` (
`OrderID` int(5) unsigned zerofill NOT NULL auto_increment,
`OrderDate` datetime NOT NULL,
`Name` varchar(100) NOT NULL,
`Address` varchar(500) NOT NULL,
`Tel` varchar(100) NOT NULL,
`Email` varchar(100) NOT NULL,
PRIMARY KEY (`OrderID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8
AUTO_INCREMENT=3 ;
4. Insert Data Into Orders
INSERT INTO `orders` VALUES (00001, '2013-08-30 09:59:13',
'Rungsan Suwannahong', '39 RMUTT Thailand', '0211245647',
'rungsansu@gmail.com');
INSERT INTO `orders` VALUES (00002, '2013-08-30 10:15:03',
'Rungsan Suwannahong', '39 RMUTT Thailand', '0211245647',
'rungsansu@gmail.com');
5. CREATE TABLE ORDERS_DETAIL
CREATE TABLE `orders_detail` (
`DetailID` int(5) NOT NULL auto_increment,
`OrderID` int(5) unsigned zerofill NOT NULL,
`ProductID` int(4) NOT NULL,
`Qty` int(3) NOT NULL,
PRIMARY KEY (`DetailID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8
AUTO_INCREMENT=5 ;
6. Insert Data Into Orders_detail
INSERT INTO `orders_detail` VALUES (1, 00001, 4, 1);
INSERT INTO `orders_detail` VALUES (2, 00002, 3, 3);
INSERT INTO `orders_detail` VALUES (3, 00002, 1, 1);
INSERT INTO `orders_detail` VALUES (4, 00002, 4, 1);
7. CREATE TABLE Product
CREATE TABLE `product` (
`ProductID` int(4) NOT NULL auto_increment,
`ProductName` varchar(100) NOT NULL,
`Price` double NOT NULL,
`Picture` varchar(100) NOT NULL,
PRIMARY KEY (`ProductID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8
AUTO_INCREMENT=5 ;
8. Insert Data Into Product
INSERT INTO `product` VALUES (1, 'Product 1', 100, '1.gif');
INSERT INTO `product` VALUES (2, 'Product 2', 200, '2.gif');
INSERT INTO `product` VALUES (3, 'Product 3', 300, '3.gif');
INSERT INTO `product` VALUES (4, 'Product 4', 400, '4.gif');