here’s my code for image display –
$username = "xxxxxxxx";
$password = "xxxxxxxx";
$host = "000.001.000.000";
$database = "xxxxxxxx";
@mysql_connect($host, $username, $password) or die("Can not connect to database: ".mysql_error());
@mysql_select_db($database) or die("Can not select the database: ".mysql_error());
$query = mysql_query("SELECT mimetype, Image FROM table ORDER BY id DESC LIMIT 0,1");
$row = mysql_fetch_array($query);
$content = $row['Image'];
header('Content-type: image/jpg');
echo $content;
This is the error i’m getting
The image “http://www….” cannot be displayed because it contains errors.
what is wrong? The datatype of field in mysql is mediumblob
OK, first test, to see what is happening:
That should either show you the results from the database, or an error message. If you see an error message, correct whatever is causing it…
After the above just returns the Database row contents:
(assuming that the
mimetypefield is something like “image/jpg”)