Displaying Items

The item display page in this chapter will simply show all the item information. In the next chapter, you'll add a few lines to it to make it function with an “add to cart” button. So for now, just assume this is a paper catalog.

Listing 20.2 shows the code for showitem.php.

Listing 20.2. Script to View Item Information
 1: <?php 2: //connect to database 3: $conn = mysql_connect("localhost", "joeuser", "somepass") 4: or die(mysql_error()); 5: mysql_select_db("testDB",$conn) or die(mysql_error()); 6: 7: $display_block = "<h1>My Store - Item Detail</h1>"; 8: 9: //validate item 10: $get_item = "select c.cat_title, si.item_title, si.item_price, 11: si.item_desc, si.item_image from store_items as si left join 12: store_categories ...

Get Sams Teach Yourself PHP, MySQL® and Apache All in One now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.