-1
I’m having difficulty solving the connection with php and BD
On the page of my project he presents the following message:
Warning: mysqli_fetch_assoc() expects Parameter 1 to be mysqli_result, Boolean Given in D: wamp64 www Plha Index.php on line 71
this part of the program refers to a slide of images that searches the path in the BD
<div id="carouselSite" class="carousel Slide" data-ride="carousel">
        <a  href="#" data-toggle="modal" data-target="#siteModalWork" class="work">
        <button type="button" class="btn btn-success">Work it us</button>
        </a>
        <ol class="carousel-indicators">
                <div class="carousel-inner">
                        <?php
                        $control_active = 2;
                        $control_position = 1;
                        $cal_carousel = "SELECT * FROM carousel ORDER BY id ASC";
                        $result_carousel = mysqli_query ($con,$cal_carousel) or mysqli_error($con);
                        while($row_carousel = mysqli_fetch_assoc($result_carousel)){
                            if($control_active == 2){?>
                                <li data-target="#carouselSite" data-slide-to="0" class="active"></li>
                                <?php
                        $control_active = 1;
                        }else{?>
                            <li data-target="#carouselSite" data-slide-to="<?php echo $control_position;?>"></li><?php
                            $control_position++;
                        }}?>
        </ol>
        <div class="carousel-inner">
                <?php
                $control_active = 2;
                $cal_carousel = "SELECT * FROM carousel ORDER BY id ASC";
                $result_carousel = mysqli_query ($con,$cal_carousel);
                while($row_carousel = mysqli_fetch_assoc($result_carousel)){
                    if($control_active == 2){?>
            <div class=" carousel-item active">
                <img src="img/<?php echo $row_carousel ['imgCarousel']; ?>"  class="img-fluid d-block cover">
            </div><?php
                $control_active = 1;
                }else{?>
            <div class=" carousel-item">
                    <img src="img/<?php echo $row_carousel ['imgCarousel'];?>" class="img-fluid d-block cover">
                </div><?php
                }}?>
        </div>
        <a class="carousel-control-prev" href="#carouselSite" role="button" data-slide="prev">
            <span class="carousel-control-prev-icon" aria-hidden="true"></span>
            <span class="sr-only">Previous</span>
        </a>
        <a class="carousel-control-next" href="#carouselSite" role="button" data-slide="next">
            <span class="carousel-control-next-icon" aria-hidden="true"></span>
            <span class="sr-only">Next</span>
        </a>
    </div>
But I have other applications that connect to the BD that get no answer
the $con variable it receives the connection by another file, the connect.php file
<?php
    $servidor = "localhost";
    $usuario = "root";
    $senha = "";
    $dbname = "plathanus";
    $con;
    $con = mysqli_connect($servidor,$usuario,$senha,$dbname) or mysqli_error($con);
Someone could give me a light?
This may help https://answall.com/questions/28184/erro-no-mysql-expects-parameter-1-to-be-resource-boolean-given-in
– Miyukii
Why not use PDO?
– Thalles Rangel