digital_plunder Posted August 25, 2011 Share Posted August 25, 2011 I m trying to fetch a image from mysql (blob) with header..here is my coding..."<?php include("db.php"); $query=mysql_query("select * from table where id='3' "); $row=mysql_fetch_array($query); $r=$row['image']; header("content-type:image"); echo $r; ?>" i want to fetch another fields from the database....but when i try to echo another fields...the page shows error or it does not echo other fields of database....please help me...how can i resolve it...i want to fetch other fields from database,like'username'password'firstname'lastname and image...thanks in advance... Link to comment https://forums.phpfreaks.com/topic/245695-need-help-about-code-to-retrieve-image-and-other-data-from-mysql/ Share on other sites More sharing options...
Adam Posted August 25, 2011 Share Posted August 25, 2011 You're outputting an image! The response PHP is sending back is "this is an image" - all of it. You can't include extra output otherwise the image data would be corrupt. You need to include a separate PHP file that handles generating only the image, but through the form of an image tag: <img src="php-script-to-generate-image.php"/> Link to comment https://forums.phpfreaks.com/topic/245695-need-help-about-code-to-retrieve-image-and-other-data-from-mysql/#findComment-1261921 Share on other sites More sharing options...
digital_plunder Posted August 26, 2011 Author Share Posted August 26, 2011 then can anyone give me proper code for fetch all the fields from mysql...with image..? Link to comment https://forums.phpfreaks.com/topic/245695-need-help-about-code-to-retrieve-image-and-other-data-from-mysql/#findComment-1262133 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.