<div class="sortable-gallery">
    <div class="wpo-section-title-s2">
        <span>Here Our Best Work</span>
        <h2>Our Resent Case Studies</h2>
    </div>
    <div class="gallery-filters case-menu">
        <ul>
            <li><a data-filter="*" href="#" class="current">All Project</a></li>
            <?php
            $cek = $db->query("select * from layihe_kateqoriya where veziyyeti='0' and lan='{$dilsec["id"]}' order by sira asc")->fetchAll(PDO::FETCH_ASSOC);
            foreach ($cek as $goster) {
            ?>
                <li><a data-filter=".<?= $goster["seo"] ?>" href="#"><?= $goster["adi"] ?></a></li>
                <!-- <li><a data-filter=".criminal" href="#">Criminal</a></li>
                                <li><a data-filter=".family" href="#">Family Matter</a></li>
                                <li><a data-filter=".real" href="#">Real Estate</a></li> -->
            <?php } ?>
        </ul>
    </div>
    <div class="case-grids gallery-container clearfix">
        <?php
        $cek = $db->query("select * from layiheler where veziyyeti='0' and lan='{$dilsec["id"]}' order by sira asc")->fetchAll(PDO::FETCH_ASSOC);
        foreach ($cek as $goster) {
            $kat = $db->query("select * from layihe_kateqoriya where id='{$goster["kategori"]}'")->fetch(PDO::FETCH_ASSOC);
        ?>
            <div class="grid real <?= $kat["seo"] ?>">
                <div class="img-holder">
                    <img src="imgupload/<?= $goster["resim"] ?>" alt="<?= $goster["adi"] ?>">
                    <div class="hover-content">
                        <a class="theme-btn-s2" href="<?= $goster["seo"] ?>"><?= $goster["adi"] ?></a>
                    </div>
                </div>

            </div>
        <?php } ?>
    </div>
</div>


burda hansi kateqoriya verilecekse yuxardaki kodlari elave edirik
layheler ucun ve ya xidmet ve mehsullar ucun layihe_kateqoriya ise hansi xidete vereceyikse onun kateqoriyasini yaziriq



<div class="section section-padding-02">
    <div class="container">
        <div class="section-title-02 text-center">
            <h2 class="title"><?= $lan['esassehife-mehsullar'] ?></h2>
        </div>
        <div class="product-wrapper-02">
            <div class="product-menu">
                <ul class="nav justify-content-center">
                    <?php
                    $cek_kategoriler = $db->query("select * from mehsul_kateqoriya where veziyyeti='0' and lan='{$dilsec["id"]}' order by sira asc")->fetchAll(PDO::FETCH_ASSOC);
                    $first_category_seo = ''; // İlk kategorinin SEO değerini tutacak değişken
                    $is_first = true; // İlk kategori kontrolü için bayrak

                    foreach ($cek_kategoriler as $goster_kategori) {
                        if ($is_first) {
                            $first_category_seo = $goster_kategori["seo"]; // İlk kategorinin SEO'sunu kaydet
                    ?>
                            <li>
                                <button class="active" data-bs-toggle="tab" data-bs-target="#tab-<?= $goster_kategori["seo"] ?>">
                                    <?= $goster_kategori["adi"] ?>
                                </button>
                            </li>
                        <?php
                            $is_first = false; // İlk kategori işlendi, bayrağı kapat
                        } else {
                        ?>
                            <li>
                                <button data-bs-toggle="tab" data-bs-target="#tab-<?= $goster_kategori["seo"] ?>">
                                    <?= $goster_kategori["adi"] ?>
                                </button>
                            </li>
                    <?php
                        }
                    } ?>
                </ul>
            </div>
            <div class="product-tabs-content">
                <div class="tab-content">
                    <?php
                    // Her kategori için ayrı bir tab-pane oluşturun
                    $is_first_content = true; // İçerik kısmında da ilk kategori kontrolü için bayrak
                    foreach ($cek_kategoriler as $goster_kategori_content) {
                        $active_class = $is_first_content ? 'show active' : ''; // İlk kategoriye "show active" sınıfını ekle
                    ?>
                        <div class="tab-pane fade <?= $active_class ?>" id="tab-<?= $goster_kategori_content["seo"] ?>">
                            <div class="row">
                                <?php
                                // İlgili kategoriye ait ürünleri çekin
                                $cek_kategori_urunler = $db->query("select * from mehsullar where veziyyeti='0' and lan='{$dilsec["id"]}' and kategori='{$goster_kategori_content["id"]}' order by sira asc")->fetchAll(PDO::FETCH_ASSOC);
                                foreach ($cek_kategori_urunler as $goster_mehsul_kateqoriya) {
                                ?>
                                    <div class="col-lg-3 col-sm-6">
                                        <div class="single-product-02">
                                            <div class="product-images">
                                                <a href="<?= $goster_mehsul_kateqoriya["seo"] ?>"><img src="imgupload/<?= $goster_mehsul_kateqoriya["resim"] ?>" width="270" height="303" alt="product" /></a>
                                                <ul class="product-meta">
                                                    <li><a class="action" data-bs-toggle="modal" data-bs-target="#quickView" href="#"><i class="pe-7s-search"></i></a></li>
                                                    <li><a class="action" href="#"><i class="pe-7s-shopbag"></i></a></li>
                                                    <li><a class="action" href="#"><i class="pe-7s-like"></i></a></li>
                                                </ul>
                                            </div>
                                            <div class="product-content">
                                                <h4 class="title">
                                                    <a href="<?= $goster_mehsul_kateqoriya["seo"] ?>"><?= $goster_mehsul_kateqoriya["adi"] ?></a>
                                                </h4>
                                                <div class="price">
                                                    <span class="sale-price">
                                                        <?= $goster_mehsul_kateqoriya["fiyat"] ?><?php if ($goster_mehsul_kateqoriya["kur"] == 0) {
                                                                                                echo '₼';
                                                                                            } else if ($goster_mehsul_kateqoriya["kur"] == 1) {
                                                                                                echo '$';
                                                                                            } else {
                                                                                                echo "€";
                                                                                            } ?>
                                                    </span>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                <?php } ?>
                            </div>
                        </div>
                    <?php
                        $is_first_content = false; // İçerik döngüsünde de ilk kategori işlendi
                    } ?>
                </div>
            </div>
        </div>
    </div>
</div>


bu kodda ise mehsullarin ilk elave edilen kateqoriyanin altindaki meshullari siralyir tum mehsulari yox


<!-- Shop Section Start -->
    <div class="section section-padding">
        <div class="container">
            <!-- Product Section Wrapper Start -->
            <div class="product-section-wrapper">
                <div class="row flex-row-reverse">
                    <div class="col-lg-9">
                        <!-- Shop top Bar Start -->
                        <div class="shop-top-bar">
                            
                        </div>
                        <!-- Shop top Bar End -->

                        <div class="tab-content">
                            <div class="tab-pane fade show active" id="grid">
                                <!-- Shop Product Wrapper Start -->
                                <div class="shop-product-wrapper">
                                    <div class="row">
                                        <?php
                            $cek = $db->query("select * from mehsullar where veziyyeti='0' and kategori='{$mehsul_kateqoriya["id"]}' and lan='{$dilsec["id"]}' order by sira asc")->fetchAll(PDO::FETCH_ASSOC);
                            foreach ($cek as $goster) {
                            ?>
                                        <div class="col-lg-4 col-sm-6">
                                            <!-- Single Product Start -->
                                            <div class="single-product">
                                                <a href="<?= $goster["seo"] ?>"><img src="imgupload/<?= $goster["resim"] ?>" width="270" height="303" alt="product" /></a>
                                                <div class="product-content">
                                                    <h4 class="title">
                                                        <a href="<?= $goster["seo"] ?>"><?= $goster["adi"] ?></a>
                                                    </h4>
                                                    <div class="price">
                                                        <span class="sale-price"><?=$goster["fiyat"]?><?php if($goster["kur"]==0){ echo '₼'; } else if($goster["kur"]==1){ echo'$';} else { echo"€";}?></span>
                                                    </div>
                                                </div>
                                                <ul class="product-meta">
                                                    <li>
                                                        <a class="action" data-bs-toggle="modal" data-bs-target="#quickView" href="#"><i class="pe-7s-search"></i></a>
                                                    </li>
                                                    <li>
                                                        <a class="action" href="#"><i class="pe-7s-shopbag"></i></a>
                                                    </li>
                                                    <li>
                                                        <a class="action" href="#"><i class="pe-7s-like"></i></a>
                                                    </li>
                                                </ul>
                                            </div>
                                            <!-- Single Product End -->
                                        </div>
                                        <?php } ?>
                                        
                                    </div>
                                </div>
                                <!-- Shop Product Wrapper End -->

                            </div>
 
                        </div>

                       
                    </div>
                    <div class="col-lg-3">
                        <!-- Sidebar Start -->
                        <div class="sidebar">
                            
                             <div class="sidebar-widget-02">

                                <h4 class="widget-title-02">Categories</h4>

                                <div class="widget-archives">
                                    <ul class="widget-link">
                                        <?php
                                    $cek=$db->query("select * from mehsul_kateqoriya where veziyyeti='0' and lan='{$dilsec["id"]}' order by sira asc")->fetchAll(PDO::FETCH_ASSOC);
                                    foreach($cek as $goster){
                                    ?>
                                        <li><a href="<?=$goster["seo"]?>"><?=$goster["adi"]?></a></li>
                                        <?php } ?>
                                    </ul>
                                </div>
                            </div>
                           
                           
                        </div>
                        <!-- Sidebar End -->
                    </div>
                </div>
            </div>
            <!-- Product Section Wrapper End -->
        </div>
    </div>
    <!-- Shop Section End -->


Soldan ve ya sagdan duzgun isleyen kateqoriya sistemi mehsullar ucun  yuxari header linkdende isleyir