-
Notifications
You must be signed in to change notification settings - Fork 0
/
product_show.php
43 lines (25 loc) · 940 Bytes
/
product_show.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
<?php
//Function used to get details of product with specific ID
require 'vendor/autoload.php';
require 'db_connect.php';
$loader = new Twig_Loader_Filesystem('templates/');
$twig = new Twig_Environment($loader, array(
// Uncomment the line below to cache compiled templates
// 'cache' => __DIR__.'/../cache',
));
if(isset($_GET['product_id'])){
$product_id = $_GET['product_id'];
$stmt = $db->prepare("SELECT * FROM products WHERE p_key_id = ?");
$stmt->execute([$product_id]);
while ($row = $stmt->fetch())
{
$product = array('p_id' => $row['p_key_id'],'id_code' => $row['p_id_code'], 'weight' => $row['p_weight'],
'area' => $row['p_area'],'lot_size' => $row['p_lot_size'], 'price' => $row['p_share_qualifier'], 'desc' => $row['p_description']);
}
echo $twig->render('product_show.html', array(
'product' => $product,
'disabled' => 'disabled'));
}
else {
$product_id = null;}
?>