Why wont the image display?

I am attempting to display information from a database onto a webpage. As shown below, the word “Description” is selected from the database and displayed without error but the image will not display. Any help would be appreciated.

Picture1

<?php
    include_once 'connection.php';
    $ID = mysqli_real_escape_string($con, $_GET['ID']);
    $sql = "SELECT * FROM items WHERE ID='$ID'";
    $result = mysqli_query($con, $sql);
    $row = mysqli_fetch_array($result);
?>

<!DOCTYPE html>
<html>
    <head>
        <meta charset='utf-8'>
    </head>
    <body>
        <?php echo $row['Discription']?>
        <img src='images/<?php echo $row['Image']?>'>
    </body>
</html>

You would think description would not be right also as it is misspelled?

Make sure you are stored in the database table correctly, have error reporting turned on and have every spelled correctly. It’s also bad practice to have the index/key capitalize $row[‘Image’] really should be $row[‘image’]. Though if you have it stored in the database table that way now then it’s to late for that.

A good debugging thing that I do is

echo "<pre>" . print_r($row, 1) . "</pre>";

Hi @Strider64, still stumped on this but thanks anyway. Yeah I see the spelling mistakes but they are the same throughout the code and database. thanks again.

Perhaps a pathing issue?

Whats the full URL when you devtool/debug it?

Does this include the extenstion?
Go to the page where it does not display. RIGHT-CLICK on the page and VEIW-SOURCE. Then, look at the real URL that is being displayed for the image and you see where the error is.

Sponsor our Newsletter | Privacy Policy | Terms of Service