i am relatively new to php. I have a problem with displaying images in my browser ( google chrome) after retrieving blob data from mysql database.
Basically the following code works when the slashes are added in front of the echo at the bottom. However i have followed other online tutorials and the tutor has been able to display their images without the use of slashes whilst i am unable to get the image up. I just wondered what the standard rule is? Another thing to add - when i do fail to get the images up in the browser i get instead a ting thumbnail. I would really appreciate if anybody could tell me how to reliably display images. The site i wish to create is just about images. So its kind of fundamental. Thanks a lot in advance for your time.
<?php $conn = mysql_connect ("localhost","root","arctic123"); $db = mysql_select_db ("user_images", $conn); if(!$db) { echo mysql_error(); } $q = "SELECT * FROM images"; $r = mysql_query ("$q",$conn); if($r) { while($row = mysql_fetch_array($r)) { //echo $row ['username']; //echo "<br>"; header ("Content-type: image/jpeg"); echo $row ['logo']; //echo "<br>"; } }else{ echo mysql_error(); } ?>
mysql_*. Those functions are deprecated and you should really be usingmysqliat a minimum...