<?php
session_start();
if (isset($_SESSION['username']))
{
include("database.php");
$username = $_SESSION['username'];
$query = "SELECT *
FROM tblpatient_pass p, tblpatient_info i
WHERE p.RelationMR_no = i.MR_no
AND p.username='$username'";
$result = mysql_query($query) or die(mysql_error());
$patient = mysql_num_rows($result);
if ($patient!=0)
{
while ($row = mysql_fetch_array($result))
{
$dMR_no = $row[0];
$dusername = $row[1];
$dpassword = $row[2];
$demail = $row[3];
$dlname = $row[5];
$dfname = $row[6];
$dgender = $row[11];
$dmname = $row[7];
$dage = $row[9];
$dcontact_no = $row[12];
$dlocation = $row[8];
// print_r($row);
}
}
else
{
die(mysql_error());
}
<?php echo "<img src=showfile.php?id=$dMR_no>"; //this is the line of code that will display a php file that contains the code for retrieving the image
}
else
die("Please Login to view this page");
?>
this is the content of showfile.php
<?php
header("Content-type: image/jpeg");
include("database.php");
$id = $dMR_no;
$image = mysql_query("SELECT * FROM tblpatient_image WHERE RelationMR_no='$id'");
$image = mysql_fetch_assoc($image);
$image = stripslashes($image['image_file']);
echo $image;
?>