Aşağıdaki kodu düşünün
<?php
$username = "root";
$password = "";
$host = "localhost";
$database = "binaries";
@mysql_connect($host, $username, $password) or die("Can not connect to database: ".mysql_error());
@mysql_select_db($database) or die("Can not select the database: ".mysql_error());
$id = 5;
if(!isset($id) || empty($id)){
die("Please select your image!");
}else{
$query = mysql_query("SELECT * FROM tbl_images WHERE id='".$id."'");
$row = mysql_fetch_array($query);
$content = $row['imag'];
header('Content-type: image/jpg');
echo '<table><tr><td height="700" width="700">';// Line X
print $content;
echo '</td></tr></table>';//Line Y
}
?>
Ben hatları X ve Y görüntü görüntülenir alır yorum, aksi not.What olası nedeni olabilir?
EDIT: Matt'in tavsiye sonra.
show.php
echo '<table><tr><td>
<img src="image.php"/>
</td></tr></table>';
image.php
$query = mysql_query("SELECT * FROM tbl_images WHERE id='".$id."'");
$row = mysql_fetch_array($query);
$content = $row['imag'];
header('Content-type: image/jpg');
print $content;
Hatta bu yaptıktan sonra ben beklenen sonucu almıyorum.
EDIT: code of 'image.php' :
<?php
$username = "root";
$password = "";
$host = "localhost";
$database = "binaries";
@mysql_connect($host, $username, $password) or die("Can not connect to database: ".mysql_error());
@mysql_select_db($database) or die("Can not select the database: ".mysql_error());
$query = mysql_query("SELECT * FROM tbl_images WHERE id=5");
$row = mysql_fetch_array($query);
$content = $row['imag'];
header('Content-type: image/jpg');
echo $content;
?>