Hi, I have managed to upload images to a table in mysql, however, i am having problems with displaying the image, all i get is a box with a red cross in it and i'm not sure what i'm doing wrong.

Here is the code i am using to view the image;

require_once ('connect.php');

$make = $_GET['make'];

if(!isset($make) ¦¦ empty($make)){
die("There is no image available");

$quert = mysql_query("select image from photo where make=$make");
$row = mysql_fetch_array($query);
$content = $row['image'];

header('Content-type: image/jpg');
echo $content;


The previous file is selecting distinct(make) from 2 tables and returning values. The $row[make] is then sent through to the above code to display the jpeg.

Can anyone help?

7 Years
Discussion Span
Last Post by pritaeas

If this is your actual code then $quert should be $query

Sorry, that was just an error when i was writing out the code, it is written correctly in my file...


Did you try the query in phpmyadmin ? Perhaps the missing single quotes trigger an error. Another reason could be that the query returns no result.

Edited by pritaeas: n/a


Figured it out!!
I put the single quotes round $make and changed the content type from image/jpg to image/jpeg, works fine, thanks.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.