亲爱的溢出者你好!
我有一些代码到目前为止运行得很好, 它获取对应的Image ID到对应的House ID,而且Caption和文件名也没有问题! 我只是无法显示图像......:( `
include("functions/config.php");
$images_dir = "/some/url/that/is/correct/cms/houses/";
$query = "SELECT houses.*, gallery_photos.* ".
"FROM houses LEFT JOIN gallery_photos ".
"ON houses.id = gallery_photos.photo_category";
$result = mysql_query($query) or die(mysql_error());
// Print out the contents of each row into a table
while($row = mysql_fetch_array($result)){
$house_id = $row['id'];
$photo_category = $row['photo_category'];
$photo_caption = $row['photo_caption'];
$photo_filename = $row['photo_filename'];
echo "House ID ". $house_id. " - ". $photo_category." - ". $photo_caption." - <img src='".$images_dir.$photo_filename."' />";
echo "<br />";
}
?>`
如上所述,所有内容都选择得很好,甚至当您在浏览器中单击“图像信息”时图像路径也是正确的,但我根本无法显示图像,我在这里错过了一些非常微不足道的东西吗?
提前致谢!
最佳答案
检查表以及存储特定图像的文件夹中的图像名称。
关于php - 从Mysql DB路径PHP调用图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19955052/