Prev | Current Page 130 | Next

Emilian Balanescu and Cristian Darie

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


A data table is made up of columns and rows. Columns are also referred to as fields, and
rows are sometimes also called records.
Because this chapter covers the only departments list, you??™ll only need to create one data
table: the department table. This table will store your departments??™ data and is one of the simplest
tables you??™ll work with.
With the help of the MySQL client console interface, it??™s easy to create a data table in the
database if you know for sure what kind of data it will store. When designing a table, you must
consider which fields it should contain and which data types should be used for those fields.
Besides a field??™s data type, there are a few more properties to consider, which you??™ll learn
about in the following pages.
To determine which fields you need for the department table, write down a few examples
of records that would be stored in that table. Remember from the previous figures that there
isn??™t much information to store about a department??”just the name and description for each
department. The table containing the departments??™ data might look like Figure 4-6 (you??™ll
implement the table in the database later, after we discuss the theory).
Figure 4-6. Data from the department table
CHAPTER 4 ?–  CREATING THE PRODUCT CATALOG: PART 1 70
From a table like this, the names would be extracted to populate the list in the upper-left part
of the web page, and the descriptions would be used as headers for the featured products list.


Pages:
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142