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); ?>FileSystem | Size | Used | Available | Used Percentage | Mount Point | Problem |
---|---|---|---|---|---|---|
".$row['filesystem']." | "; echo "".$row['size']." | "; echo "".$row['used']." | "; echo "".$row['available']." | "; echo "".$row['used_perc']." | "; echo "".$row['mount_point']." | "; echo "".$row['problem']." | "; echo "
All Rights Reserved
}
}
setInterval(function () {
if ($('.blink').length > 0) {
if ($('.blink').hasClass('blinkOn'))
setTimeout(function() { $('.blink').removeClass('blinkOn') , 100})
else
setTimeout(function () { $('.blink').addClass('blinkOn'), 100 })
}
}, 1000);
}