-
Notifications
You must be signed in to change notification settings - Fork 0
/
product.php
49 lines (46 loc) · 1.77 KB
/
product.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
$title = "اطلاعات کالا";
include("includes/header.php");
include("includes/db_link.php");
$id = 0;
$query = "";
if (isset($_GET['id'])) {
$id = $_GET["id"];
setcookie("last-viewed-item", $id);
$query = "SELECT * FROM products WHERE id = '$id'";
} else {
if (isset($_COOKIE["last-viewed-item"])) {
$id = $_COOKIE["last-viewed-item"];
$query = "SELECT * FROM products WHERE id = '$id'";
echo "شما درحال مشاهده آخرین کالایی که بازدید کردید هستید.";
// TODO: add to project_guide
} else {
exit("<span class='error'>خطایی در حین دریافت اطلاعات کالا از دیتابیس رخ داده.</span>");
}
}
$request = mysqli_query($link, $query);
?>
<table style="width: 100%" border='0' cellpadding="10px">
<tre>
<?php
if ($row = mysqli_fetch_array($request)) {
?>
<td style="vertical-align: top; width: 100%; display:flex;flex-direction: column">
<h2 style='color:saddlebrown;align-self: center'><?= $row["name"]; ?></h2>
<img src='products/<?= $row["image"]; ?>' style="align-self: center">
<br>
<span style='font-size:18px'>قیمت: <?= toman($row["price"], true); ?></span> <br>
<span style='font-size:18px'>موجودی: <?= $row["qty"]; ?> </span> <br>
<span style="font-size: 14px; text-align: justify">توضیحات: <?= $row["details"]; ?> </span> <br>
<br>
<strong><a href='order.php?id=<?= $row["id"]; ?>'>سفارش این کالا ←</a></strong>
</td>
</td>
<?php
}
?>
</tr>
</table>
<?php
include("includes/footer.php");
?>