query($query); $category = $category->fetch(); //get first entry of PDO statement object $category_name = $category['categoryName']; //echo $category_name; //testing //get all categories $query = 'SELECT * FROM categories ORDER BY categoryID'; $categories = $db->query($query); //get all products for selected category $query = "SELECT * FROM products WHERE categoryID = $category_id ORDER BY productID"; $products = $db->query($query); /* foreach ($products as $p) { echo $p['productCode'] ."; "; echo $p['productName'] ."; "; echo $p['listPrice'] ."
\n"; } */ ?> Kungfu Panda Shop

Product List

Code Name Price
$

Add Product