<?php 
$faq = mysqli_query($dbconn, "select * from faq_tbl where category_id='$cat_res[catID]'");
if(mysqli_num_rows($faq)>'0'){
?>
<div class="faq_section">
    <div class="container">
        <h3 class="title_2">FAQs <?=$cat_res['displayName'];?></h3>
        <div class="clearfix"></div>

        <div class="accordion" id="accordionExample" itemscope itemtype="https://schema.org/FAQPage" >
             <?php 
            $i=1;
                while ($faq_res = mysqli_fetch_array($faq)) { ?>
            <div class="accordion-item wow fadeInLeft" data-wow-delay=".<?= $i;?>s" itemscope itemprop="mainEntity" itemtype="https://schema.org/Question">
                <h4 class="accordion-header" id="heading_<?=$i?>" itemprop="name">
                    <span class="accordion-button <?php if($i!=1) { echo 'collapsed';} ?>" role="button" data-bs-toggle="collapse" data-bs-target="#faq_<?=$i?>" aria-expanded="true" aria-controls="heading_<?=$i?>"><?=$faq_res['question'];?>
                    </span>
                </h4>
                <div id="faq_<?=$i?>" class="accordion-collapse collapse <?php if($i==1) { echo 'show';} ?> " aria-labelledby="heading_<?=$i?>" data-bs-parent="#accordionExample" itemprop="suggestedAnswer acceptedAnswer" itemscope itemtype="https://schema.org/Answer">
                    <div class="accordion-body" itemprop="text">
                        <?=$faq_res['answer'];?>
                    </div>
                </div>
            </div>
           
            <?php $i++; } ?>
        </div>
    </div>

</div>
<?php } ?>