我编写下面的代码来显示数据库中的图像
<?php
mysql_connect("localhost","root","");
mysql_select_db("test");
$qry = "select id from image";
$res = mysql_query($qry) or die(mysql_error());
while($row = mysql_fetch_array($res))
{
echo "<img src=image.php?id='$row[0]'>";
}
?>
图片.php
<?php
$query = mysql_query("SELECT img FROM images WHERE id = ".$_GET['id']);
$row = mysql_fetch_array($query);
if($type=="pjpeg")
$type="jpeg";
header("Content-type:$type");
echo $row['img'];
?>
但这行不通。它显示空白图像图标。