<?php define("guvenlik",true);?>
<?php
require('func/db.php');
require('func/fonksiyon.php');?>



<?php

if($_POST){?>
<div class="js_prs_search" style="">

<?php 
$arama = $_POST['query']; 
$ara = explode(" ", $arama);
$adi = "";
$urunkodu = "";
$aciklama = "";
foreach($ara as $a)
{
    $adi .= "adi LIKE '%" . $a . "%' AND ";
    $urunkodu .= "urunkodu LIKE '%" . $a . "%' AND ";
    $aciklama .= "aciklama LIKE '%" . $a . "%' AND ";
}
$adi = rtrim($adi, ' AND ');
$urunkodu = rtrim($urunkodu, ' AND ');
$aciklama = rtrim($aciklama, ' AND');

$query = $ozy->prepare("SELECT * FROM urunler WHERE durum = '1' AND $adi OR $urunkodu OR $aciklama");
$query->execute();
$duy = $query->fetchAll(PDO::FETCH_ASSOC);

if (!empty($duy)) {
    foreach ($duy as $results) {?>
	
        <div class="item">
      <div class="product-item">
         <div class="product-image">
            <a href="urun/<?php echo $results['seo'];?>" class="image_product">
            <img srcset="resimler/urunler/<?php echo $results['resim'];?>?v=1672302207&amp;width=165 165w,resimler/urunler/<?php echo $results['resim'];?>?v=1672302207&amp;width=360 360w,
			resimler/urunler/<?php echo $results['resim'];?>?v=1672302207&amp;width=533 533w,
			resimler/urunler/<?php echo $results['resim'];?>?v=1672302207&amp;width=720 720w,
			resimler/urunler/<?php echo $results['resim'];?>?v=1672302207&amp;width=940 940w,
			resimler/urunler/<?php echo $results['resim'];?>?v=1672302207 1000w
               " src="resimler/urunler/<?php echo $results['resim'];?>?v=1672302207&amp;width=533" sizes="(min-width: 1170px) 260px, (min-width: 990px) calc((100vw - 130px) / 4), (min-width: 750px) calc((100vw - 120px) / 3), calc((100vw - 35px) / 2)" alt="Laptop Apple MacBook Pro M1 16GB/512GB" class=" motion-reduce default_media" width="1000" height="1000" loading="lazy">
            </a>
         </div>
         <div class="product-content">
            <a class="product-title " href="urun/<?php echo $results['seo'];?>"><?php echo $results['adi'];?></a>
            <div class="product-price">
			    <?php echo urunfiyatbelirle($results['kdv'],$results['idurum'],$results['fiyat'],$results['ifiyat']);?>

			
			
			</div>
         </div>
      </div>
   </div>
 
<?php }
} else {
    echo "<li>Aranan ürün malesef mevcut değil 😕</li>";
}
?>

</div>
	 <?php }?>
