Prev | Current Page 198 | Next

Emilian Balanescu and Cristian Darie

"Beginning PHP and MySQL E-Commerce: From Novice to Professional, Second Edition"

The category table will have four fields, described in Table 5-1.
Table 5-1. Designing the category Table
Field Name Data Type Description
category_id int An autoincrement integer that represents the unique ID
for the category. It is the primary key of the table, and it
doesn??™t allow NULLs.
department_id int An integer that represents the department the category
belongs to. It doesn??™t allow NULLs.
name varchar(100) Stores the category name. It does not allow NULLs.
description varchar(1000) Stores the category description. It allows NULLs.
There are two ways to create the category table and populate it: either execute the SQL
scripts from the Source Code/Download section of the Apress web site (http://www.apress.com/)
or follow the steps in the following exercise.
Exercise: Creating the category Table
1. Using phpMyAdmin, navigate to your tshirtshop database.
2. Click the SQL button in the top menu, and use the form to execute the following SQL query, which creates
the category table (alternatively, you can use phpMyAdmin to create the table by specifying the fields
using a visual interface as you did in Chapter 4 for the department table).
-- Create category table
CREATE TABLE 'category' (
'category_id' INT NOT NULL AUTO_INCREMENT,
'department_id' INT NOT NULL,
'name' VARCHAR(100) NOT NULL,
'description' VARCHAR(1000),
PRIMARY KEY ('category_id'),
KEY 'idx_category_department_id' ('department_id')
) ENGINE=MyISAM;
CHAPTER 5 ?–  CREATING THE PRODUCT CATALOG: PART 2 120
3.


Pages:
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210
tani nocleg online loans for bad credit rating Wnętrza Poznań pozycjonowanie stron w google wanna poolspa