Php 使用Div显示MySql数据

Php 使用Div显示MySql数据,php,html,mysql,twitter-bootstrap,Php,Html,Mysql,Twitter Bootstrap,如何显示mysql数据库中的图像,特别是一行中的两个图像。我在stack overflow中读过很多文章,所有这些都是使用table标记讨论的。但是我找不到任何使用div的文章。 这是我的SQL代码,它不完全正确。(显示图像,但顺序不正确): $result=mysql\u查询(“从标记为“$tag”的图像中选择*); 而($info=mysql\u fetch\u数组($result)) { if($count==2)//每行两个图像 { 打印“”; $count=0; } 如果($count

如何显示mysql数据库中的图像,特别是一行中的两个图像。我在stack overflow中读过很多文章,所有这些都是使用table标记讨论的。但是我找不到任何使用div的文章。 这是我的SQL代码,它不完全正确。(显示图像,但顺序不正确):

$result=mysql\u查询(“从标记为“$tag”的图像中选择*);
而($info=mysql\u fetch\u数组($result))
{
if($count==2)//每行两个图像
{
打印“”;
$count=0;
}
如果($count==0)
打印“”;
?>
这段代码应该是怎么来的

<div class="row">
    <div class="col-md-4 col-sm-4 gallery-display">
        <figure>
            <a href="first-image.php">
                <img src="1.jpg" alt="Texture Paper" class="display-image">
            </a>
            <a href="first-image.php" class="figcaption">
                <h3>Texture Paper</h3>
            </a>
        </figure>
        <!--figure-->
    </div>
    <div class="col-md-4 col-sm-4 gallery-display">
        <figure>
            <a href="sec-image.php">
                <img src="2..jpg" alt="Photo (:" class="display-image">
            </a>
            <a href="sec-image.php" class="figcaption">
                <h3>Photo Caption</h3>
            </a>
        </figure>

    </div>
    <!--.gallery-display-->
<div class="row">
<div class="col-md-4 col-sm-4 gallery-display">
..........loop code continues.......

循环代码继续。。。。。。。

它看起来像是您想要使用的。在发布此类内容之前,您可能需要检查一下,因为这似乎是重复的/非常类似于


使用时要非常小心,避免出现严重的问题。
mysql\u query
很难正确使用,不应该在新的应用程序中使用。这是一个不推荐使用的界面,正在从未来的PHP版本中删除。这是一个现代的替代品,类似于,是一种更安全的组合查询的方式。使用任何CSS框架,就像任何建议将代码替换为连续显示两个图像?
<div class="row">
    <div class="col-md-4 col-sm-4 gallery-display">
        <figure>
            <a href="first-image.php">
                <img src="1.jpg" alt="Texture Paper" class="display-image">
            </a>
            <a href="first-image.php" class="figcaption">
                <h3>Texture Paper</h3>
            </a>
        </figure>
        <!--figure-->
    </div>
    <div class="col-md-4 col-sm-4 gallery-display">
        <figure>
            <a href="sec-image.php">
                <img src="2..jpg" alt="Photo (:" class="display-image">
            </a>
            <a href="sec-image.php" class="figcaption">
                <h3>Photo Caption</h3>
            </a>
        </figure>

    </div>
    <!--.gallery-display-->
<div class="row">
<div class="col-md-4 col-sm-4 gallery-display">
..........loop code continues.......