Ajax software
Free javascripts
↑
Main Page
INSERT INTO `product_categories` (product_id, category_id) VALUES (1, 3);
INSERT INTO `product_categories` (product_id, category_id) VALUES (2, 4);
INSERT INTO `product_categories` (product_id, category_id) VALUES (2, 5);
INSERT INTO `product_categories` (product_id, category_id) VALUES (3, 6);
INSERT INTO `product_categories` (product_id, category_id) VALUES (4, 2);
INSERT INTO `product_categories` (product_id, category_id) VALUES (4, 3);
INSERT INTO `product_categories` (product_id, category_id) VALUES (5, 1);
INSERT INTO `product_categories` (product_id, category_id) VALUES (6, 7);
INSERT INTO `product_categories` (product_id, category_id) VALUES (6, 8);
INSERT INTO `product_categories` (product_id, category_id) VALUES (6, 3);
6.
The last table you’re creating is
products
. This contains data about each product sold by the
Cookie Ogre’s Warehouse:
CREATE TABLE `products` (
`id` int(11) NOT NULL auto_increment,
`brand_id` int(11) NOT NULL default ‘0’,
`name` varchar(255) NOT NULL default ‘’,
`price` double(8,2) NOT NULL default ‘0.00’,
`desc` text NOT NULL,
`primary_category_id` int(11) NOT NULL default ‘0’,
PRIMARY KEY (`id`)
);
INSERT INTO `products` VALUES (1, 1, ‘Matt Cutts’‘ Spam Flavored Cookie’, 2.00,
‘This delicious cookie tastes exactly like spam.’, 3);
INSERT INTO `products` VALUES (2, 2, ‘Jeremy Zawodny’‘s Snickerdoodles’, 3.00,
‘These cookies are the Zawodny Family secret recipe, passed down throughout the
generations. They are low fat and low sugar.’, 4);
INSERT INTO `products` VALUES (3, 3, ‘Bill Gates’‘ Cookie’, 999999.99, ‘These
cookies taste like... a million bucks. Note: before consuming, these cookies must
be activated by Microsoft.’, 6);
INSERT INTO `products` VALUES (4, 4, ‘Jeeve’‘s Favorite Frosted Cookie’, 2.00,
‘Shaped like a butler, sugar coated. Now in Christmas holiday colors.’, 3);
INSERT INTO `products` VALUES (5, 1, ‘Google Menorah Cookies’, 3.00, ‘Snatched from
one of the famed snack bars at Google while all of the employees were home. ‘, 1);
INSERT INTO `products` VALUES (6, 2, ‘Frosted Fortune Cookie’, 2.00, ‘Dipped
organic sugar.’, 7);
7.
Now you need to create a file named
config.inc.php
, in your
seophp/include
folder, with
the following code. You should already have this file from the geo-targeting exercise; make sure
it contains the following constant definitions:
<?php
// site domain; no trailing ‘/‘ !
define(‘SITE_DOMAIN’, ‘http://seophp.example.com’);
// defines database connection data
define(‘DB_HOST’, ‘localhost’);
265
Chapter 14: Case Study: Building an E-Commerce Store
c14.qxd:c14 10:46 265
Ajax software
Free javascripts
→