當我試圖從數據庫中顯示圖像圖像未顯示不知道是什麼問題,這是我的代碼。無法顯示圖像
show_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);
}
?>
Display.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="show_desc.php?img_id=<?php echo mysql_result($rsPix,$i,"img_id"); ?>"
<?php
$i++;
}
?>
任何人都可以請幫助我?
這個論壇是不是讓我把圖像標籤,它是while條件後,即使在數據庫中的IMG字段被標記不顯示圖像作爲二進制 – Shruti 2010-06-26 13:55:42