Not able to connect my PHP application with Maria DB in docker

I am getting below error Warning: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, null given in /path.php on line 49

Warning: mysqli_close() expects parameter 1 to be mysqli, null given in /path on line 63

my code is like this to make connection, I think my APP container is not connecting with DB container,same time my both containers are up, I can check app and for db part the values are not coming as I see this error is stoping me. I can see that $result is not returning, means query is not executing in data base. how to figure out this error ? also is there a way to troubleshoot connections like by individual commands to know where it is failing ? if yes then how. from app container to db container

<?php $servername = "mysql"; $username = "root"; $password = "xyz"; $dbname = "db"; $conn = mysqli_connect($servername, $username, $password, $dbname); if (!$conn) { die("Connection failed: " . mysqli_connect_error()); } $sql = "select filesystem, size, used, available, used_perc, mount_point,problem from usage_disk"; $result = mysqli_query($conn, $sql); ?> .blinkOn { background-color:red; } Monitor Apps
Monitor Apps Home <?php while($row = mysqli_fetch_assoc($result)) { echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; }//end while mysqli_close($conn); ?>
FileSystem Size Used Available Used Percentage Mount Point Problem
".$row['filesystem']."".$row['size']."".$row['used']."".$row['available']."".$row['used_perc']."".$row['mount_point']."".$row['problem']."

All Rights Reserved

var rows = document.querySelectorAll('#tbl tr'); for (var i = 0; i < rows.length; i++) { var row = rows[i]; var cells = row.getElementsByTagName('td'); for (var j = 0; j < cells.length; j++) { var cell = cells[j]; if(j==6) { var value = parseFloat(cell.innerText.trim()) if (value == 1) { row.className = 'blink' console.log(value); }
        }

    }
    setInterval(function () {
        if ($('.blink').length > 0) {

            if ($('.blink').hasClass('blinkOn'))
                setTimeout(function() {      $('.blink').removeClass('blinkOn') , 100})
             else
                setTimeout(function () {   $('.blink').addClass('blinkOn'), 100 })

        }

    }, 1000);
}