<?php
session_write_close();
// Include the database configuration file
if (isset($_GET['Ordersn']))
{
$ordersn=$_GET["Ordersn"];
if(!$dbh = mysqli_connect("localhost", "dbName","PassWord")) {
die("ERROR: " . mysqli_error());
}
mysqli_select_db($dbh, "shopeeprint");
$str="SELECT image,ordersn,FileName FROM orderPrint WHERE ordersn='$ordersn'";
//echo($str);
if(!$res = mysqli_query($dbh,$str )) {
die("ERROR: " . mysqli_error($dbh));
}
$row = mysqli_fetch_assoc($res);
$data = $row['image'];
header("Content-Type: image/".pathinfo( $row['FileName'], PATHINFO_EXTENSION));
echo $data;
} else die("err");