爆炸函数和路径检索有问题吗?如何正确使用它


Having issue in explode function and path retrieval?How to use it properly

在数据库中,多个图像名称以逗号分隔存储,图像存储在上传文件夹中。现在我想检索数据从数据库使用爆炸函数。我所做的到目前为止,我的页面视图源返回这个。我不知道哪里出错了。请指引我。在数据库中,像这样存储图像。Lighthouse.jpg、Penguins.jpg Tulips.jpg。我在while循环中使用了foreach。我应该使用foreach还是使用while循环本身我们可以检索数据

My page view source is returning this
<img src="upload/L"  />
<img src="upload/P"  />
<img src="upload/T"  />
 here is my php code
    <?php
    $sub=mysql_query("select iname from properties ps ");
    while($listnew=mysql_fetch_array($sub))
    {
    $res = explode(",", $listnew['iname']);
    foreach ($res as $item) {
    ?>
    <img src="<?php echo "upload/".$item['iname'];?>"  />
    <?php
    }
    }
    ?>

应该是这样的,因为你在$item中已经有了你的每个图像名称,然后遍历已爆炸的数组:

<img src="<?php echo "upload/".$item;?>"  />