我想知道如何使用PHP代碼顯示存儲在特定div
內的數據庫中的圖像?使用PHP顯示從數據庫檢索的圖像
我使用的代碼看起來像這樣:
<form method="post">
<input type="button" name="show" value="show"/><br/>
<input type="image" id="image_show" name="img" value="img"/>
</post>
if(@$_POST['show'])
{
$sql="select imageData form images ORDER BY DESC";
$result=mysql_query($sql) or die('invalid query'.mysql_error());
//set header
header("Content-type:image/png");
echo mysql_result($result,0);
while($row = mysql_fetch_row($result))
{
echo "<img src='".$row[0]."'/>";
}
}
但它不工作。我怎樣才能解決這個任務?
首先,我們需要知道如何將圖像保存在數據庫中。你保存路徑還是保存blob?圖像列的價值的例子是什麼? – vajrasky 2013-04-04 10:01:11