happycoder Posted September 15, 2011 Share Posted September 15, 2011 Hello everyone! The reason I came to these forums is because i have an issue with my code, could you guys look at it and tell me what i am doing wrong?I am trying to retrieve an image from my SQL database in the form of a binary blob, but it doesn't show up. This is the code of the PHP file i am using in my image src html tag: <?phprequire_once("connect.php"); $imgd = $_get['img'];$query="SELECT * FROM ads WHERE id=$imgd";$result=mysql_query($query) or die ("Error - ");$row = mysql_fetch_assoc($result);$image = $row['fotolocatie']; echo $image;;?> it doesn't show the error so it isn't the query witch fails. - Kevin Link to comment Share on other sites More sharing options...
Synook Posted September 15, 2011 Share Posted September 15, 2011 You need to set the content type using the header() function before any output: header("content-type:image/jpeg"); // or whatever content type your image is Link to comment Share on other sites More sharing options...
justsomeguy Posted September 15, 2011 Share Posted September 15, 2011 You also need to capitalize $_GET. Link to comment Share on other sites More sharing options...
happycoder Posted September 15, 2011 Author Share Posted September 15, 2011 Oh man, I've wasted hours trying to fix this and the problem was 3 letters not being capitalized..Thanks guys! It works now! -kevin Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.