<th>Product Type</th> <th>Unit Price</th> <th>Added On</th> <th>Edit</th> <th>Delete</th> </tr> </thead> <tbody> <?php foreach ($res as $table_item) { ?> <?php $pt_id = $table_item['product_type_id']; $product_type_name = find_product_type_name($pt_id); $subcategory_name = find_subcategory_name($pt_id); $category_name = find_category_name($pt_id); ?> <tr> <td><?php echo $table_item['product_id']; ?> </td> <td><?php echo $table_item['product_name']; ?> </td> <td><?php echo $category_name['category_name']; ?> </td> <td><?php
exit; } // Gather this product's full information for inserting automatically into the edit form below on page $pid_for_img = ""; $pname_for_img = ""; if (isset($_GET['product_id'])) { $targetID = $_GET['product_id']; $sql = myQuery("SELECT * FROM products WHERE product_id=:product_id LIMIT 1", array(':product_id' => $targetID), $conn); if ($sql->rowCount() > 0) { $res = $sql->fetchAll(PDO::FETCH_ASSOC); foreach ($res as $row) { $pid_for_img = $_GET['product_id']; $pname_for_img = $row['product_name']; $product_name = $row['product_name']; $unit_price = $row['unit_price']; $category = find_category_name($row['product_type_id']); $subcategory = find_subcategory_name($row['product_type_id']); $product_type = find_product_type_name($row['product_type_id']); $product_description = $row['product_description']; $date_added = strftime("%b %d, %Y", strtotime($row['date_added'])); } } else { $data = "Sorry! No such product exists."; } } include "directory_from_admin.php"; include "../views/header.view.php"; include "../views/admin/admin_header.view.php"; include '../views/admin/update_product.view.php'; include "../views/admin/admin_footer.view.php"; ?>