<?php
$faq = mysqli_query($dbconn, "select * from faq_tbl");
?>
<div class="faq_section">
    <div class="container">
        <div class="title_2">FAQs</div>
        <div class="clearfix"></div>

        <div class="accordion" id="accordionExample">
            <?php
            $i = 1;
            while ($faq_res = mysqli_fetch_array($faq)) { ?>

                <div class="accordion-item wow fadeInLeft" data-wow-delay=".2s">
                    <div class="accordion-header" id="heading_<?= $i ?>">
                        <span class="accordion-button" role="button" data-bs-toggle="collapse" data-bs-target="#faq_<?= $i ?>" aria-expanded="true" aria-controls="heading_<?= $i ?>"><?= $faq_res['question'] ?>
                        </span>
                    </div>
                    <div id="faq_<?= $i ?>" class="accordion-collapse collapse <?php if ($i == 1){echo 'show'; } ?>" aria-labelledby="heading_<?= $i ?>" data-bs-parent="#accordionExample">
                        <div class="accordion-body">
                            <p><?= $faq_res['answer'] ?></p>
                        </div>
                    </div>
                </div>
            <?php $i++;
            } ?>
        </div>
    </div>

</div>