Hey I am trying to display an image whose local link is saved in MySQL database. I am writing a SQL query to select the required local link which is further stored in a variable to be passed to HTML image display function. The problem is that image is not being displayed rather short square containing cross symbol is being displayed.
// skipping the coding in which SQL connection is made and php script starting syntax
<?php
$sql = "SELECT locallink FROM timetable WHERE id=6";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
$a = $row["locallink"];
}
}else {
echo "0 results";
}
?>
<!DOCTYPE html>
<html>
<body>
<img src="<?php echo $a ?>" alt="Section A timetable">
</body>
</html>