Hệ thống quản lý hàng tồn kho bằng PHP

1 <?php
2     require_once(
'../../inc/config/constants.php');
3     require_once(
'../../inc/config/db.php');
4     
5     
if(isset($_POST['id'])){
6         
7         $productID = htmlentities($_POST[
'id']);
8         
9             
10         $defaultImgFolder =
'data/item_images/';
11         
12         
// Get all item details
13         $sql =
'SELECT * FROM item WHERE productID = :productID';
14         $stmt = $conn->prepare($sql);
15         $stmt->execute([
'productID' => $productID]);
16         
17         
while($row = $stmt->fetch(PDO::FETCH_ASSOC)){
18             $output =
'<p><img src="';
19         
20             
if($row['imageURL'] === '' || $row['imageURL'] === 'imageNotAvailable.jpg'){
21                 $output .=
'data/item_images/imageNotAvailable.jpg" class="img-fluid"></p>';
22             }
else {
23                 $output .=
'data/item_images/' . $row['itemNumber'] . '/' . $row['imageURL'] . '" class="img-fluid"></p>';
24             }
25                         
26             $output .=
'<span><strong>Name:</strong> ' . $row['itemName'] . '</span><br>';
27             $output .=
'<span><strong>Price:</strong> ' . $row['unitPrice'] . '</span><br>';
28             $output .=
'<span><strong>Discount:</strong> ' . $row['discount'] . ' %</span><br>';
29             $output .=
'<span><strong>Stock:</strong> ' . $row['stock'] . '</span><br>';
30         }
31         
32         echo $output;
33     }
34 ?>


Gõ tìm kiếm nhanh...