13.09.2016 Views

PHP and MySQL Web Development 4th Ed-tqw-_darksiderg

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

620 Chapter 28 Building a Shopping Cart<br />

The display_categories() function converts each category from the database into a<br />

link. Each link goes to the next script—show_cat.php—but each has a different parameter,<br />

the category ID or catid. (This unique number, generated by <strong>MySQL</strong>, is used to<br />

identify the category.)<br />

This parameter to the next script determines which category you end up looking at.<br />

Listing Books in a Category<br />

The process for listing books in a category is similar.The script that does this, called<br />

show_cat.php, is shown in Listing 28.6.<br />

Listing 28.6<br />

show_cat.php—Script That Shows the Books in a Particular Category<br />

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!