Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/gwt/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 将mySQL数据库中的数据回送到3x3网格中_Php_Mysql_Twitter Bootstrap - Fatal编程技术网

Php 将mySQL数据库中的数据回送到3x3网格中

Php 将mySQL数据库中的数据回送到3x3网格中,php,mysql,twitter-bootstrap,Php,Mysql,Twitter Bootstrap,所以我试图从我的数据库中回显一些数据 <?php $connect = mysql_connect('xxxxx', 'xxxxx', 'xxxxx'); mysql_select_db("xxxxx", $connect) or die(mysql_error()); $lsql = "SELECT * FROM xxxxxxx ORDER BY Value DESC LIMIT 6"; $lquery = m

所以我试图从我的数据库中回显一些数据

    <?php

        $connect = mysql_connect('xxxxx', 'xxxxx', 'xxxxx');
        mysql_select_db("xxxxx", $connect) or die(mysql_error());

        $lsql = "SELECT * FROM xxxxxxx ORDER BY Value DESC LIMIT 6";

        $lquery = mysql_query($lsql) or die(mysql_error());


        while ($lrow = mysql_fetch_array($lquery))
            $lrows[] = $lrow;

                foreach ($lrows as $lrow){
                      $ProperBrand = $lrow['ProperBrand'];
                      $LowerBrand = $lrow['LowerBrand'];
                      $PageTitle = $lrow['PageTitle'];
                      $PageH1 = $lrow['PageH1'];
                      $PageExcerpt = $lrow['PageExcerpt'];
                      $ContentP1 = $lrow['ContentP1'];
                      $ContentP2 = $lrow['ContentP2'];
                      $Image1 = $lrow['Image1'];
                      $Image2 = $lrow['Image2'];
                      $Image3 = $lrow['Image3'];
                      $BrandURL = $lrow['BrandURL'];

                    echo ('
                    <div class="col-sm-2">
                    <img src="'. $Image1 .'" class="top-images-larger">
                    </div>
                                ');



                    } 
    ?>

您好您可以使用echo显示带有html表格的网格:

<?php
    echo "<table>
          <tr>
            <th>column1</th>
            <th>column2</th> 
            <th>column3</th>
          </tr>
          <tr>
            <td>".$lrow['yourdata']."</td>
            <td>".$lrow['yourdata2']."</td> 
            <td>".$lrow['yourdata3']."</td>
          </tr>
        </table>";
?>


希望我能帮上忙

有什么特别的原因可以解释为什么你使用的是一个不推荐使用的mysql api而不是mysqli或pdo以及一个预先准备好的语句,用户输入应该成为图片的一部分吗?你需要养成习惯,它可以帮助你解决问题。您将获得积分,并鼓励其他人帮助您。警告:如果您只是学习PHP,请不要学习过时的界面。这很糟糕,已经在PHP7中删除了。替换类和指南类有助于解释最佳实践。确保你的用户参数是正确的,否则你会得到严重的结果。嘿,但是如果有9个块,它会使用你上面给出的例子来回显3个表。否?
<?php
    echo "<table>
          <tr>
            <th>column1</th>
            <th>column2</th> 
            <th>column3</th>
          </tr>
          <tr>
            <td>".$lrow['yourdata']."</td>
            <td>".$lrow['yourdata2']."</td> 
            <td>".$lrow['yourdata3']."</td>
          </tr>
        </table>";
?>