<?php //connect to the database - either include a connection variable file or //type the following lines: //Create the ecommerce database if (mysql_query("CREATE DATABASE ecommerce")) { echo "Woo hoo! Database created! <br>"; } else { echo "Sorry, try creating the database again."; } mysql_select_db("ecommerce"); //Define the product table query = "CREATE TABLE products ( products_prodnum CHAR(5) NOT NULL, products_name VARCHAR(20) NOT NULL, products_proddesc TEXT NOT NULL, products_price DEC (6,2) NOT NULL, products_dateadded DATE NOT NULL, PRIMARY KEY(products_prodnum))"; query) or die(mysql_error()); //Define the customer table customers = mysql_query(//Define the general order table query3 = "CREATE TABLE ordermain ( ordermain_ordernum INT(6) NOT NULL AUTO_INCREMENT, ordermain_orderdate DATE NOT NULL, ordermain_custnum INT(6) NOT NULL, ordermain_subtotal DEC (7,2) NOT NULL, ordermain_shipping DEC (6,2), ordermain_tax DEC(6,2), ordermain_total DEC(7,2) NOT NULL, ordermain_shipfirst VARCHAR(15) NOT NULL, ordermain_shiplast VARCHAR(50) NOT NULL, ordermain_shipcompany VARCHAR (50), ordermain_shipadd1 VARCHAR (50) NOT NULL, ordermain_shipadd2 VARCHAR(50), ordermain_shipcity VARCHAR(50) NOT NULL, ordermain_shipstate CHAR(2) NOT NULL, ordermain_shipzip CHAR(5) NOT NULL, ordermain_shipphone CHAR(12) NOT NULL, ordermain_shipemail VARCHAR(50), PRIMARY KEY(ordermain_ordernum)) "; query3) or die(mysql_error()); //Define the order details table orderdet = mysql_query(
(C) Æliens 20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.