هذا الكود يقوم بعرض جدول واحد فقط وهو car
انا لدي عدة جداول فاريد وضعهم مع car
مثل جدول alic,wod,honey وغيره من الجداول
<?php
$category_name = $_GET['category'];
$select_products = $conn->prepare("SELECT * FROM `car` WHERE category = ? ORDER BY id DESC");
$select_products->execute([$category_name]);
if($select_products->rowCount() > 0){
while($fetch_products = $select_products->fetch(PDO::FETCH_ASSOC)){
?>
<form action="" class="box" method="POST">
<div class="price">السعر:<span><?= $fetch_products['price']; ?></span></div>
<div class="moheeb1"><?= $fetch_products['date']; ?></div>
<a href="viewpage.php?pid=<?= $fetch_products['id']; ?>" >
<img src="uploaded_img/<?= $fetch_products['image'];?>" style="max-width:30%;height: auto;border-radius:20px;width:50;height:50;" alt=""></a>
<a href="viewpage.php?pid=<?= $fetch_products['id'];?>"><div class="moheeb2"><?= $fetch_products['name']; ?></div></a>
<input type="hidden" name="pid" value="<?= $fetch_products['id']; ?>">
<input type="hidden" name="p_name" value="<?= $fetch_products['name']; ?>">
<input type="hidden" name="p_price" value="<?= $fetch_products['price']; ?>">
<input type="hidden" name="p_image" value="<?= $fetch_products['image']; ?>">
</form>
<?php
}
}else{
echo '<p class="empty">ليس هناك إعلانات</p>';
}
?>
التعليقات