arkadaşlar merhaba;

şu şekilde

            <?php 
            $projesayisor=$db->prepare("SELECT proje_id FROM proje where proje_durum = '3'");
            $projesayisor->execute();
            $projesayisi = $projesayisor->rowCount();
            ?>
            <div class="col-xl-2 col-md-6 mb-4">
                <div class="card border-left-primary shadow h-100 py-2">
                    <div class="card-body">
                        <div class="row no-gutters align-items-center">
                            <div class="col mr-2">
                                <div class="text-xs font-weight-bold text-primary text-uppercase mb-1">Aktif Proje <b>Sayısı</b></div>
                                <div class="h4 mb-0 font-weight-bold text-gray-800"><?php echo $projesayisi; ?></div>
                            </div>
                            <div class="col-auto">
                                <i class="fas fa-list fa-2x text-gray-300"></i>
                            </div>
                        </div>
                    </div>
                </div>
            </div>


            <?php 
            $proje_biten_sayi_sor=$db->prepare("SELECT proje_id FROM proje WHERE proje_durum='4'");
            $proje_biten_sayi_sor->execute();
            $alinan_say = $proje_biten_sayi_sor->rowCount();
            ?>
            <div class="col-xl-2 col-md-6 mb-4">
                <div class="card border-left-success shadow h-100 py-2">
                    <div class="card-body">
                        <div class="row no-gutters align-items-center">
                            <div class="col mr-2">
                                <div class="text-xs font-weight-bold text-success text-uppercase mb-1">Alınan <b>İşler</b> </div>
                                <div class="h4 mb-0 font-weight-bold text-gray-800">
                                    <?php echo 
                                    $alinan_say; ?></div>
                                </div>
                                <div class="col-auto">
                                    <i class="fas fa-calendar-check fa-2x text-gray-300"></i>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

where ile farklı sonuç almak istediğim 2 sorgu var ama aynı kodlar tekrar yazıyorum bunun yerine kullanabileceğim bir yöntem var mı