Prev | Current Page 141 | Next

Emilian Balanescu and Cristian Darie

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


?– Note Alternatively, you can use the SQL scripts from the Source Code/Download section of the Apress web
site to create and populate the department table. You can find the database creation scripts in the Database
folder for this chapter in the code download for this book. You can also find the files on the authors??™ web sites.
CHAPTER 4 ?–  CREATING THE PRODUCT CATALOG: PART 1 76
Exercise: Creating the department Table
1. Point your web browser to your phpMyAdmin location (http://localhost/phpmyadmin/), like you did in
Chapter 3 when creating the tshirtshop database.
2. Select the tshirtshop database from the Database combo box in the left side of the window. Type
department in the Name text box of the ???Create a new table on database tshirtshop??? section, and type 3 in
the ???Number of fields??? text box, as shown in Figure 4-10.
Figure 4-10. Adding the department table to the database
3. Click Go. You??™ll be presented with a screen where you need to specify the details for each of the three table
columns as shown in Figure 4-11.
If you prefer to type the SQL code yourself instead of using the visual builder of phpMyAdmin, here??™s the
code you need (you can find it in the source code download as well):
-- Create deparment table
CREATE TABLE `department` (
`department_id` INT NOT NULL AUTO_INCREMENT,
`name` VARCHAR(100) NOT NULL,
`description` VARCHAR(1000),
PRIMARY KEY (`department_id`)
) ENGINE=MyISAM;
CHAPTER 4 ?–  CREATING THE PRODUCT CATALOG: PART 1 77
Figure 4-11.


Pages:
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153