在php中显示来自数据库的多个图像 [英] display multiple image from database in php

查看:72
本文介绍了在php中显示来自数据库的多个图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我获取单张图片。我如何获取多个图像。请发送代码。

img1.php

i fetch single image . how i fetch multiple image. please send the code.
img1.php

展开 | 选择 | Wrap | 行号

推荐答案

你好,

使用mysql_fetch assoc();

并使用for;循环,或if n while你可以单击检索所有图像
hello,
use mysql_fetch assoc();
and using "for" loop, or "if n while" u can retrieve all the images on single click


当你有PHP通过标题功能将mime-type设置为图像的mime-type时,请求成为图片。因此,每个请求不能打印多个图像。


这意味着要在每页打印多个图像,您需要对PHP脚本发出多个请求,每个请求代表一个单个图像(就像您使用普通图像一样)。通常你有两个脚本,一个打印页面的HTML,提取图像元数据并添加< img>标签,每个调用第二个PHP脚本,同时传递图像的ID。


第二个PHP脚本然后只提取并打印该单个图像的数据。

When you have PHP set the mime-type via the header function to that of an image, that requests becomes an image. Thus, you can not print more than a single image per request.

Which means that to print multiple images per page, you need to make multiple requests to the PHP script, each one representing a single image (just like you would with normal images). Usually you have two scripts, one that prints the HTML of the page, fetches the image meta-data and adds <img> tags, each one calling a second PHP script while passing it the ID of an image.

The second PHP script then just fetches and prints the data of that single image.


请发送密码。
please send the code.



不会发生。我们很乐意引导您解决在编写自己的代码时可能遇到的问题,但我们不会简单地为您编写代码并将其移交。

Not going to happen. We are happy to guide you through problems you may face while writing your own code, but we will not simply write it for you and hand it over.


我在哪个程序中使用循环和mysql_fetch_assoc。
In which program i use for loop and mysql_fetch_assoc .


这篇关于在php中显示来自数据库的多个图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆