December 2013
Intermediate to advanced
306 pages
6h 26m
English
From a customer perspective, it is useful to be able to narrow down your catalogue by viewing products by category, such as shoes, shirts, coats, and so on. If you wish to add this functionality, you'll need to amend the database. If you require this feature, copy the code in the following Getting ready section.
In order to support searching and filtering by categories, we'll need to add a categories table. If you haven't already done this during the Getting ready section earlier in the chapter, create the following table in your database:
CREATE TABLE IF NOT EXISTS `categories` ( `cat_id` int(11) NOT NULL AUTO_INCREMENT, `cat_name` varchar(50) NOT NULL, PRIMARY KEY (`cat_id`) ) ENGINE=InnoDB ...
Read now
Unlock full access