duangua6912 2017-02-24 22:24
浏览 60

显示来自concat mysql和php的图像

I'm trying to display some images inside php.

<?php
    $sql1 = "
   SELECT data1.id
         , data1.profileid
         , data1.Employer
         , CONCAT('[',GROUP_CONCAT(data2.Url),']') Url 
      FROM database1 data1 
      LEFT 
      JOIN database2 data2 
          ON data1.id = data2.employerid 
     WHERE data1.profileid = '$session' 
     GROUP 
        BY data1.id
         , data1.profileid
         , data1.Employer";
        $resultEmployer = mysqli_query($db, $sql1) or die;

    if (mysqli_num_rows($resultEmployer) > 0)
        {
            while($row = mysqli_fetch_assoc($resultEmployer))
            {
               $employer    .= "" . $row['Employer'] . "";
               $employer    .= "" . $row['Url'] . "";
                    }
            }
    ?>

The output from the database inside php is:

I don't know how to put these links (from the CONCAT in MYSQL) inside an img-tag to display the images and not the url(s) itself. I tried this without success:

<?php
$employer .= "<img src=" . $row['Url'] . "";
?>

Who can help me? Thank you.

</div>
  • 写回答

1条回答 默认 最新

  • duanli0453 2017-02-24 23:47
    关注

    You want the output of your image tag to look like this:

    <img src="THEURL">
    

    Right now you're not putting the url in quotes or closing the tag. You'd need to do something like this

    $employer .= '<img src="' . $row['Url'] . '">';
    
    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度