prepare($query); $statement->bindValue(":category_id", $category_id); $statement->execute(); $products = $statement->fetchAll(); $statement->closeCursor(); return $products; } /*********************************************** * step 3 * delete_product($product_id) ***********************************************/ function delete_product($product_id) { global $db; $query = 'DELETE FROM products WHERE productID = :product_id'; $statement = $db->prepare($query); $statement->bindValue(':product_id', $product_id); $statement->execute(); $statement->closeCursor(); } /*********************************************** * step 5 * add_product($category_id, $code, $name, $price) ***********************************************/ function add_product($category_id, $code, $name, $price) { global $db; $query = 'INSERT INTO products (categoryID, productCode, productName, listPrice) VALUES (:category_id, :code, :name, :price)'; $statement = $db->prepare($query); $statement->bindValue(':category_id', $category_id); $statement->bindValue(':code', $code); $statement->bindValue(':name', $name); $statement->bindValue(':price', $price); $statement->execute(); $statement->closeCursor(); } ?>