Hi,
I'm new at PHP, and was using a tutorial available at Codewalkers.com to learn how to perform image uploading and viewing through MySQL.
The tutorial I was using is available here.
Although I was able to successfully retrieve and view images using the provided tutorial code, upon adapting it for my code I am encountering a problem. I'm supposed to retrieve the image [stored as a BLOB] along with some other form data, but instead of displaying the image, I'm just getting a large chunk of binary text.
Click here for an example of what I'm talking about.
Here is the code for the above example. I hope you can help me figure out how to get my image to display properly! I know it's possible, as I have similar code that works, but I can't put my finger on why this is happening. Here's the code:
<?php
$db = mysql_connect(xxxxxxxxxxxxx);
mysql_select_db("Honor_Bios",$db);
$first_name=$_GET[first_name];
$last_name=$_GET[last_name];
$hometown=$_GET[hometown];
$age=$_GET[age];
$major=$_GET[major];
$anything=$_GET[anything];
$image_type=$_GET[image_type];
$image=$_GET[image];
$id=$_GET[id];
$result = mysql_query("SELECT * FROM Freshmen WHERE id=$id",$db);
$myrow = @mysql_fetch_array ($result);
$image_type = $myrow["image_type"];
$image = $myrow["image"];
Header ("Content-type: $image_type");
print $image;
echo "First Name: ".$myrow["first_name"];
echo "<br>Last Name: ".$myrow["last_name"];
echo "<br>Hometown: ".$myrow["hometown"];
echo "<br>Age: ".$myrow["age"];
echo "<br>Major: ".$myrow["major"];
echo "<br>Anything else: <pre>".$myrow["anything"];
echo "</pre>";
?>
Thanks in advance!
-Bard09