-
Notifications
You must be signed in to change notification settings - Fork 0
/
supplier_show.php
44 lines (26 loc) · 973 Bytes
/
supplier_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
44
<?php
//Lists details of specific supplier
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['supplier_id'])){
$supplier_id = $_GET['supplier_id'];
$stmt = $db->prepare("SELECT * FROM suppliers WHERE id = ?");
$stmt->execute([$supplier_id]);
while ($row = $stmt->fetch())
{
$supplier = array('s_id' => $row['id'],'s_name' => $row['s_name'], 's_address' => $row['s_address'],
's_postcode' => $row['s_postcode'],'s_city' => $row['s_city'],'s_email' => $row['s_email'],
's_delivery_way' => $row['delivery_way'],'s_delivery_term' => $row['deliveryterm']);
}
echo $twig->render('supplier_show.html', array(
'supplier' => $supplier,
'disabled' => 'disabled'));
}
else {
$supplier_id = null;}
?>