-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsingleProduct.php
49 lines (36 loc) · 1.05 KB
/
singleProduct.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
49
<?php
require_once "classes/DBAccess.php";
$title = "Single Product";
$pageHeading = "Single Product";
//get database settings
include "settings/db.php";
//create database object
$db = new DBAccess($dsn, $username, $password);
//connect to database
$pdo = $db->connect();
// if(isset($_GET["id"]))
// {
// $prodId = $_GET["id"];
// }
// elseif (isset($_POST["itemId"]))
// {
// $prodId = $_POST["itemId"];
// }
// else
// {
// $prodId = 0;
// }
$prodId = $_GET["id"];
$sql = "SELECT photo, price, salePrice, itemName, description, itemId, category.categoryName, item.categoryId FROM item
LEFT JOIN category ON category.categoryId = item.categoryId WHERE itemID = :itemId";
$stmt = $pdo->prepare($sql);
$stmt->bindValue(":itemId" , $prodId, PDO::PARAM_INT);
$rows = $db->executeSQL($stmt);
//start buffer
ob_start();
//display products
include "templates/singleProductCard.html.php";
$output = ob_get_clean();
include "templates/layoutProductPage.html.php";
$db->disconnect();
?>