$sql=mysql_query(
"SELECT ssmid, image FROM user_photos_offline WHERE ssmid='$ssmid' AND status='1'
UNION
SELECT ssmid, image FROM user_profile_pic WHERE ssmid='$ssmid' AND status='1'
UNION
SELECT ssmid, image FROM user_family_photos WHERE ssmid='$ssmid' AND status='1' "
);
while($row=mysql_fetch_assoc($sql)){
echo $result = $row['image'];// Here i got all images name from DB
}
此代码工作正常,$结果我从DB获取所有值,但这个图像我移动了三个不同的文件夹,这些是文件夹名称裁剪图像,家庭照片,个人资料照片
如何在<img src='?????'>
答案 0 :(得分:0)
mysql_ *扩展在PHP 5.5.0中已弃用,并且已在PHP中删除 7.0.0。相反,应使用MySQLi或PDO_MySQL扩展名。
试试这个
$folder_names = array("cropped-images","profile-photos","family-photos");
$i = 0;
while($row=mysql_fetch_assoc($sql)){
echo $result = $row['image'];// Here i got all images name from DB
echo "<img src='".$folder_names[$i]."/".$result."'>";
$i++;
}