-2

I am trying to build a forum with a search bar and in my index.php I have an error. My code

    <?php 
    session_start();
    require('actions/questions/showAllQuestionsAction.php');
    ?>
    <!DOCTYPE html>
    <html lang="en">
    <?php include 'includes/head.php'; ?>
    <body>
    <?php include 'includes/navbar.php'; ?>
    <br><br>

    <div class="container">
    
        <form method="GET">

            <div class="form-group row">

                <div class="col-8">
                    <input type="search" name="search" class="form-control">
                </div>
                <div class="col-4">
                    <button class="btn btn-success" type="submit">Rechercher</button>
                </div>

            </div>
        </form>

        <br>

        <?php 
            while($question = $getAllQuestions->fetch_assoc()){
                ?>
                <div class="card">
                    <div class="card-header">
                        <a href="article.php?id=<?= $question['id']; ?>">
                            <?= $question['titre']; ?>
                        </a>
                    </div>
                    <div class="card-body">
                        <?= $question['description']; ?>
                    </div>
                    <div class="card-footer">
                        Publié par <a href="profile.php?id=<?= $question['id_auteur']; ?>"><?= $question['pseudo_auteur']; ?></a> le <?= $question['date_publication']; ?>
                    </div>
                </div>
                <br>
                <?php
            }
        ?>

    </div>

</body>
</html>

The error: Fatal error: Uncaught Error: Call to a member function fetch_assoc() on bool in C:\wamp64\www\forum\index.php on line 31 ( ! ) Error: Call to a member function fetch_assoc() on bool in C:\wamp64\www\forum\index.php on line 31

Dharman
  • 26,923
  • 21
  • 73
  • 125
  • 1
    @ADyson Look at the bright side. At least it's a bit better than "_it's not working_" without anything else. – Michel May 27 '22 at 13:56

0 Answers0