dongyu7074 2013-09-05 09:32
浏览 36
已采纳

如何在单个HTTP响应中使用PHP从Mysql服务4个图像(Blob)?

I am trying to display 4 images using PHP and MySQL database. I have to display the 4 images as rows.

I use the table cars with fields (id_car, car_image1, car_image2, car_image3, car_image4), with all the images being blob datatype.

$id = $_GET['id'];

$link = mysql_connect("localhost", "root", "");
mysql_select_db("cars_database");
$sql = "SELECT car_image1, car_image2, car_image3, car_image4 FROM cars WHERE id_car='$id'";
$result = mysql_query("$sql");

mysql_close($link);
while($row=mysql_fetch_array($result))
{
    header('Content-type: image/jpeg');
    echo $row['car_image1'];
    echo $row['car_image2'];
    echo $row['car_image3'];
    echo $row['car_image4'];    
}

I can only display 1 image and not the other images. Since I am a newbie to this technology I need help.

  • 写回答

2条回答 默认 最新

  • douxi3233 2013-09-05 09:36
    关注

    That's how HTTP works (at least, current version): you cannot have a URL that points to more than one resource simultaneously. Your script needs to send one image.

    Simply, call it four times:

    <img src="/get-image.php?id=1">
    <img src="/get-image.php?id=2">
    <img src="/get-image.php?id=3">
    <img src="/get-image.php?id=4">
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 对于squad数据集的基于bert模型的微调
  • ¥15 为什么我运行这个网络会出现以下报错?CRNN神经网络
  • ¥20 steam下载游戏占用内存
  • ¥15 CST保存项目时失败
  • ¥15 树莓派5怎么用camera module 3啊
  • ¥20 java在应用程序里获取不到扬声器设备
  • ¥15 echarts动画效果的问题,请帮我添加一个动画。不要机器人回答。
  • ¥15 Attention is all you need 的代码运行
  • ¥15 一个服务器已经有一个系统了如果用usb再装一个系统,原来的系统会被覆盖掉吗
  • ¥15 使用esm_msa1_t12_100M_UR50S蛋白质语言模型进行零样本预测时,终端显示出了sequence handled的进度条,但是并不出结果就自动终止回到命令提示行了是怎么回事: