topical media & game development
basic-php-15-create.php / php
<?php
//connect to the database - either include a connection variable file or
//type the following lines:
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(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.