我正在尝试显示来自数据库的图像并且我能够得到它,但问题是,即使我上传了不同的图像,它也显示相同的图像。
这是我的代码:
<?php
$con = mysql_connect('localhost','root','')
or die(mysql_error());
mysql_select_db ("dbname");
$query = "SELECT * FROM news ORDER BY date DESC";
$result = mysql_query($query);
echo "<table align='center'>";
while($row = mysql_fetch_assoc($result))
{
echo "<tr>";
echo "<td>";
echo "<img src='getImage.php?id='".$row['id']."' height='230px' width='300px'> <br /><br />";
//Some codes here...
echo "</table>";
mysql_close($con);
?>
获取图像.php
<?php
$con = mysql_connect('localhost','root','')
or die(mysql_error());
mysql_select_db ("dbname");
$query = "SELECT * FROM news ORDER BY date DESC";
$result = mysql_query($query);
header("Content-type: image/png");
while($row = mysql_fetch_assoc($result))
{
echo $row['image'];
}
mysql_close($con);
?>
请。帮我...