-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
37 lines (37 loc) · 1.4 KB
/
index.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
<?php
$title = "صفحه اصلی";
include('./includes/header.php');
include('./includes/db_link.php');
$query = "SELECT * FROM `products` ORDER BY `id` DESC";
$request = mysqli_query($link, $query);
?>
<table border="0" cellspacing="5px" cellpadding="7px" style="width:100%">
<tr>
<?php
$counter = 0;
while ($row = mysqli_fetch_array($request)) {
$counter++;
?>
<td style='border:1px solid #999;vertical-align:top;width:33%;'><a href="product.php?id=<?= $row["id"]; ?>">
<h4 style='color:saddlebrown;text-align:center;margin:10px 0'><?= $row["name"]; ?></h4>
<img src='products/<?= $row["image"]; ?>' width="250px" height="150px">
</a> <br>
<span>قیمت: <?= toman($row["price"], true); ?></span> <br>
<span>موجودی: <?= $row["qty"]; ?> </span> <br>
<span style="font-size: 14px">توضیحات: <?= details($row['details'], 100) ?> </span> <br>
<br>
<strong><a href='product.php?id=<?= $row["id"]; ?>'>ادامه توضیحات و خرید ←</a></strong>
</td>
<?php
if ($counter % 3 == 0) {
echo "</tr><tr>";
}
}
if ($counter % 3 != 0) {
echo "</tr>";
}
?>
</table>
<?php
include('./includes/footer.php');
?>