我试图在php中显示一些图像。
tmp
php内部数据库的输出是:
杰克 [' https://example.com/jake1.jpg,https://example.com/jake2.jpg,https://example.com/jake3.jpg']
斯蒂芬妮 [' https://example.com/stephanie1.jpg,https://example.com/stephanie2.jpg,https://example.com/stephanie3.jpg']
我不知道如何将这些链接(来自MYSQL中的CONCAT)放在img-tag中以显示图像而不是url(s)本身。我试了这个没有成功:
<?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'] . "";
}
}
?>
&#13;
谁能帮帮我?谢谢。
答案 0 :(得分:0)
您希望图片代码的输出如下所示:
<img src="THEURL">
目前您还没有将网址放在引号中或关闭标记。你需要做这样的事情
$employer .= '<img src="' . $row['Url'] . '">';