当试图从数据库中显示形象时,没有展示图像时,不知道问题是什么,即我的代码。
显示_desc.php
<?php
$errmsg = "";
if (! @mysql_connect("localhost","root","")) {
$errmsg = "Cannot connect to database";
}
@mysql_select_db("dbname");
if (isset($_GET[ img_name ])) {
$gotten = @mysql_query("select img from image where img_id = ".$_GET[ img_name ]);
header("Content-type: image/x-ms-bmp");
while ($row = mysql_fetch_array($gotten)) {
print $row[ img ];
}
mysql_free_result($gotten);
}
?>
显示.php
<?php
$errmsg = "";
if (! @mysql_connect("localhost","root","")) {
$errmsg = "Cannot connect to database";
}
@mysql_select_db("dbase_mgb");
$strSQL = "select * from image";
$rsPix = mysql_query($strSQL);
$numRows = mysql_numrows($rsPix);
$i = 0;
while($i < $numRows) {
?>
<image src="显示_desc.php?img_id=<?php echo mysql_result($rsPix,$i,"img_id"); ?>"
<?php
$i++;
}
?>
谁能帮助我?