Meabhy Meabhy - 3 months ago 29
MySQL Question

Displaying images using mySql and php

I'm a newbie coder. This is a follow on question to the original one I posted. I was having diffs displaying my images using php and mysql. With the help of stackoverflow, my site now knows that I want to display an image, but when inspected using the developer tools on Chrome, it gives a 404 error and says the image cannot be found.

The image is stored as a png, but when I look at the 404 error I see that the browser thinks it is html/text. I have tried swapping in other images that are displaying correctly elsewhere on my site, and they don't display either.

Why does chrome think my image is a html/text when the document has a .php extension, and my code says the image is .png?

Answer

You don'T use the tag in your second echo

echo '<tr><td>' . $row['plant_name'] . '</td><td><img src="' . $row['plant_img']. 
'"></td><td>' . $row['plant_type'] . '</td><td>' . $row['soil_ph_min'] . 
'</td><td>' . $row['soil_ph_max']     . '</td><td>' . $row['soil_type'].
'</td><td>' . $row['top_tip'] . '</td></tr>' ;
}

That should do the trick for you