douci2015 2016-09-22 03:25
浏览 46

在爆炸功能和路径检索中有问题?如何正确使用它

In database multiple image name is stored with comma separation and image is stored in upload folder.Now I want retrieve the data from db using explode function. what I have done so far,My page view source is returning this.I dont know where I went wrong. kindly guide me. In db the image stored like this. Lighthouse.jpg,Penguins.jpg,Tulips.jpg. I have used foreach in while loop.shall i want to use foreach or with the help of while loop itself we can retrieve the data

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
    }
    }
    ?>
  • 写回答

1条回答 默认 最新

  • douchuitang0331 2016-09-22 03:29
    关注

    It should be like this because u already have ur each image name in $item after exploding and then iterating through exploded array:

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

报告相同问题?

悬赏问题

  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?