ranura Posted June 4, 2012 Share Posted June 4, 2012 I'm trying to display an image form the mysql database. I have this code. But it returns, "Warning: Cannot modify header information - headers already sent by (output started at E:\Softwares\WAMP\wamp\www\site\index.php:5)" When i commented the "header('Content-type: ' . $row_getImage['mimetype']);" line, it will not display an error though displays something like hashcode instead of the image. Please look at the attachment. What can I do for this? [size=12pt] <?php $connect = mysql_connect("localhost", "root", "123") or die ("Error, check your server connection."); $database_testConn = mysql_select_db("test1") or die("cannot select DB"); $query_getImage = "SELECT mimetype, image FROM images"; $getImage = mysql_query($query_getImage, $connect) or die(mysql_error()); while($row_getImage = mysql_fetch_array($getImage)){ header('Content-type: ' . $row_getImage['mimetype']); echo $row_getImage['image']; mysql_free_result($getImage); } mysql_close(); ?>[/size] Link to comment https://forums.phpfreaks.com/topic/263627-display-image-from-mysql-databse/ Share on other sites More sharing options...
Barand Posted June 4, 2012 Share Posted June 4, 2012 http://www.phpfreaks.com/forums/index.php?topic=359914.msg1702703#msg1702703 Link to comment https://forums.phpfreaks.com/topic/263627-display-image-from-mysql-databse/#findComment-1351058 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.