-
Notifications
You must be signed in to change notification settings - Fork 0
/
view.php
48 lines (36 loc) · 975 Bytes
/
view.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>View Product</title>
</head>
<body>
<?php
require_once ('dbconfig.in.php');
include_once ('product.php');
$pdo = conection_database();
my_header();
echo "<hr>";
if (isset($_GET['id']) && !empty($_GET['id'])) {
$product_id = $_GET['id'];
$query = "SELECT * FROM products WHERE id = :id";
$stmt = $pdo->prepare($query);
$stmt->bindValue(':id', $product_id);
$stmt->execute();
$product = $stmt->fetchObject('Product');
if ($product) {
$product_details = $product->displayProdcutPage();
echo $product_details;
} else {
echo "<p>Product not found!</p>";
}
} else {
echo "<p>No product ID provided!</p>";
}
?>
<?php
echo "<hr>";
my_footer();
?>
</body>
</html>