Prev | Current Page 127 | Next

Emilian Balanescu and Cristian Darie

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

Create the department table in the database. This table will store data regarding the
store??™s departments. Before adding this table, you??™ll learn the basic concepts of working
with relational databases.
2. Write aMySQL stored procedure named catalog_get_departments_list, which returns
the IDs and names of the departments from the department table. PHP scripts will call
this stored procedure to generate the departments list for your visitor. MySQL stored
procedures are logically located in the data tier of your application. At this step, you??™ll
learn how to speak to your relational database using SQL.
Presentation Tier
Smarty Componentized Template:
departments_list.tpl (Smarty Design Template)
load_presentation_object (Generic Smarty Function Plug-in)
DepartmentsList (Presentation Object)
Business Tier
PHP Code:
catalog.php (Contains the Catalog Class and its GetDepartments Method)
database_handler.php (Contains the DatabaseHandler Class)
error_handler.php (Contains the ErrorHandler Class)
Web Server
Data Tier
MySQL Stored Procedure: catalog_get_departments_list()
MySQL Server
Data
MySQL
Data Store
Department
(Data Table)
CHAPTER 4 ?–  CREATING THE PRODUCT CATALOG: PART 1 68
3. Create the DatabaseHandler class, which will be your helper class that performs
common database interaction operations. DatabaseHandler is a wrapper class for
some PDO methods and includes consistent error-handling techniques that deal
with database-related errors.


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