<?php
include('include/main.inc.php');
$sel_faq_query = "Select * from faq_tbl order by slno asc";
$res_faq = $dbconn->query($sel_faq_query);
if($res_faq->num_rows > 0){
    $sno = 0;
    
?>
<div class="faq_section">
    <div class="container">
    <div class="sec-title with-text text-center">
                <p>FAQs</p>
                <h4 class="title">Frequently Asked Questions</h4>
                <div class="border-box center"></div>
            </div>
        <div class="clearfix"></div>

        <div class="accordion" id="accordionExample">
            <?php while($faqs = $res_faq->fetch_assoc()){
                $sno++;
            ?>
            <div class="accordion-item wow fadeInLeft" data-wow-delay=".<?= $sno; ?>s">
                <h4 class="accordion-header" id="heading_<?= $sno; ?>">
                    <span class="accordion-button <?= ($sno == 1) ? '': 'collapsed'; ?>" role="button" data-bs-toggle="collapse" data-bs-target="#faq_<?= $sno; ?>" aria-expanded="<?= ($sno == 1) ? 'true': 'false'; ?>" aria-controls="heading_<?= $sno; ?>"><?= $faqs['question']; ?>
                    </span>
                </h4>
                <div id="faq_<?= $sno; ?>" class="accordion-collapse collapse <?= ($sno == 1) ? 'show': ''; ?>" aria-labelledby="heading_<?= $sno; ?>" data-bs-parent="#accordionExample">
                    <div class="accordion-body">
                        <p><?= $faqs['answer']; ?></p>
                    </div>
                </div>
            </div>
            <?php } ?>
        </div>
    </div>

</div>
<?php } ?>