Hey guys,
Can you all help and teach me how to retrieve image file which is stored on database?..
I had an image stored on database in the column i called 'profpic'. By the way, I am needing this information for profile picture on a users page.
I've started testing some codes based on some sources but seems like I don't get the right procedure fitting for my program.
Here is the code segment
<?php
include 'dbconnect.php';
echo 'under profile.php';
$username=$_SESSION['username'];
$query="SELECT accntnum FROM accntinfos WHERE username='$username'";
$result=mysql_query($query, $DBconnect);
if($accntnum=mysql_fetch_assoc($result))
$accntnum=$accntnum['accntnum'];
$query="SELECT profpic FROM userprofile WHERE accntnum='$accntnum'";
$result=mysql_query($query, $DBconnect);
//$numrows=mysql_num_rows($result);
//PROBLEM STARTS HERE
header('Content-type: image/jpeg');
//i know there should be some proper codes here but I don't know how to start it...
?>
There are two tables here 'accntinfos' and 'userprofile'. These is just a segment but if you'ld need the two files for clarity just ask. Thanks