我的三个自举面板在一行中水平解析

时间:2017-06-21 01:33:51

标签: php html

Goodday ..请给我新来的..我的代码有问题..我试图在三个bootstrap面板中显示mysql数据......我希望它们在一行中显示所有三个面板.. ..这是我的代码......我不介意我的编码方法......我很欣赏更正...

<div class="container-fluid" style="margin-top: 100px;">



        <div><!--//news slider div-->


        </div><!-- end of news slider div-->




    <div class="row">

        <div class="col-sm-4">

            <div class="panel panel-default">
                    <div class="panel-heading">
                        <h1 class="">LATEST NEWS</h1>
                    </div>
                    <?php
//selesct post from database and display to frontend

                    $selectpost = "SELECT * FROM blogposts ORDER BY post_date DESC";
                    $result = mysql_query($selectpost);
                    if (mysql_num_rows($result) > 0) {

                        while ($postrow = mysql_fetch_array($result)) {
                            $title = $postrow['post_title'];
                            $cont = $postrow['post_content'];
                            $date = $postrow['post_date'];                 
                            $author =$postrow['post_author'];
                            ?>

                <div class="panel-body">
                    <div class="content-div">
                        <h3><a href=""><?= ($title); ?></a></h3>
                        <h5 class="text-success"><i class="fa fa-calendar"></i>&nbsp;&nbsp;Posted On:<?= ($date); ?>&nbsp;  
                            <i class="fa fa-user"></i>&nbsp;&nbsp;
                                    Author:<?= ($author); ?></h5>
                            <p><?= ($cont); ?></p> 
                    </div>
                            <?php
                        }
                    }
                    ?>
                </div>
            </div>
        </div>

        <div class="col-sm-4">
            <div class="panel panel-default">
                    <div class="panel-heading">

                        <h1 class="">BLOG POST</h1>
                    </div>
                    <?php
//selesct post from database and display to frontend

                    $selectpost = "SELECT * FROM blogposts ORDER BY post_date DESC";
                    $result = mysql_query($selectpost);
                    if (mysql_num_rows($result) > 0) {

                        while ($postrow = mysql_fetch_array($result)) {
                            $title = $postrow['post_title'];
                            $cont = $postrow['post_content'];
                            ?>
                <div class="panel-body">
                    <div class="content-div">
                        <h3><a href=""><?= ($title); ?></a></h3>
                        <h5 class="text-success"><i class="fa fa-calendar"></i>&nbsp;&nbsp;Posted On:<?= ($date); ?>&nbsp;
                        </span>  
                            <i class="fa fa-user"></i>&nbsp;&nbsp;
                                    Author:<?= ($author); ?></h5>
                            <p><?= ($cont); ?></p> 
                    </div>
                            <?php
                        }
                    }
                    ?>
                </div>
            </div>
        </div>

        <div class="col-sm-4">
            <div class="panel panel-default">
                    <div class="panel-heading">                         
                        <h1 class="">SIDEBAR</h1>
                    </div>
                        <?php
//selesct post from database and display to frontend

                    $selectpost = "SELECT * FROM blogposts ORDER BY post_date DESC";
                    $result = mysql_query($selectpost);
                    if (mysql_num_rows($result) > 0) {

                        while ($postrow = mysql_fetch_array($result)) {
                            $title = $postrow['post_title'];
                            $cont = $postrow['post_content'];
                            ?>
                <div class="panel-body">
                    <div class="content-div">
                        <h3><a href=""><?= ($title); ?></a></h3>
                        <h5 class="text-success"><i class="fa fa-calendar"></i>&nbsp;&nbsp;Posted On:&nbsp;&nbsp;<?= ($date); ?>&nbsp;  
                            <i class="fa fa-user"></i>&nbsp;&nbsp;
                            Author:&nbsp;<?= ($author); ?></h5>
                            <p><?= ($cont); ?></p> 
                    </div>
                            <?php
                        }
                    }
                    ?>
                </div>
            </div>
        </div>

    </div>
</div><!--end of content container-->

以下是一些图片......请帮我解决这个问题..谢谢 .. 对不起,我发现上传图片很难...谢谢

0 个答案:

没有答案