vendredi 30 juillet 2021

How can I solve mysqli_fetch_assoc(false)? [duplicate]

I have tried and error for several hours, but still can't find how to get the right way, it keeps showing

[::1]:56462 [200]: POST /school.php - Uncaught TypeError: mysqli_fetch_assoc(): Argument #1 ($result) must be of type mysqli_result, bool given in C:\Users\ying qi\Desktop\Rate This Uni\school.php:17 Stack trace: #0 C:\Users\ying qi\Desktop\Rate This Uni\school.php(17): mysqli_fetch_assoc(false) #1 {main} thrown in C:\Users\ying qi\Desktop\Rate This Uni\school.php on line 17

Here is the code around line 17

<?php
            $result = mysqli_query($con,"SELECT school_title FROM schools WHERE school_id=$sid"); 
            while($row = mysqli_fetch_assoc($result)) { 
                echo $row['school_title'];}
            ?>

How can I solve it?




Aucun commentaire:

Enregistrer un commentaire