显示PHP / sql

时间:2017-09-27 15:53:03

标签: php html sql twitter-bootstrap mysqli

我正在做一个小应用程序。问题是,当我运行它时,它只显示300行,当我应该有大约2000个插入测试时。它只是没有显示它们。它显示312行,而不是其余行。

以下是代码:

    <!-- page content -->
        <div class="right_col" role="main">

            <div class="page-title">
                <div class="title_left">
                    <h3>Raw Inventory</h3>
                </div>

                <div class="title_right">
                    <div class="col-md-5 col-sm-5 col-xs-12 form-group pull-right top_search">
                        <div class="input-group">
                            <input type="text" class="form-control" placeholder="Search for...">
                            <span class="input-group-btn">
                      <button class="btn btn-default" type="button">Go!</button>
                    </span>
                        </div>
                    </div>
                </div>
            </div>


            <div class="row">
                <div class="col-md-12 col-sm-12 col-xs-12">
                    <div class="x_panel">
                        <div class="x_title">
                            <h2>Assets List</h2>
                            <ul class="nav navbar-right panel_toolbox">
                                <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
                                </li>
                                <li><a class="close-link"><i class="fa fa-close"></i></a>
                                </li>
                            </ul>
                            <div class="clearfix"></div>
                        </div>
                        <div class="x_content">
                            <div class="wrapper">
                                <div class="container-fluid">
                                    <div class="row">
                                        <div class="col-md-12">
                                            <div class="page-header clearfix">
                                                <h2 class="pull-left"></h2>
                                                <a href="create.php" class="btn btn-success pull-right">Add a new Asset</a>
                                            </div>
                                            <?php
                                            // Include config file
                                            require_once 'config.php';

                                            // Attempt select query execution
                                            $sql = "SELECT * FROM t_assets";
                                            if($result = mysqli_query($db, $sql)){
                                                if(mysqli_num_rows($result) > 0){
                                                    echo "<table class='table table-bordered table-striped'>";
                                                    echo "<thead>";
                                                    echo "<tr>";
                                                    echo "<th>Asset</th>";
                                                    echo "<th>Model</th>";
                                                    echo "<th>Status</th>";
                                                    echo "<th>Location</th>";
                                                    echo "<th>Action</th>";

                                                    echo "</tr>";
                                                    echo "</thead>";
                                                    echo "<tbody>";
                                                    while($row = mysqli_fetch_array($result)){
                                                        echo "<tr>";
                                                        echo "<td>" . ucfirst ($row['a_asset']) . "</td>";
                                                        echo "<td>" . $row['a_model'] . "</td>";
                                                        echo "<td>" . ucfirst($row['a_status']) . "</td>";
                                                        echo "<td>" . ucfirst($row['a_location']) . "</td>";
                                                        echo "<td>";
                                                        echo "<a href='read.php?id=". $row['a_asset'] ."' title='View Record' data-toggle='tooltip'><span class='glyphicon glyphicon-eye-open'></span></a>  ";
                                                        echo "<a href='update.php?id=". $row['a_asset'] ."' title='Update Record' data-toggle='tooltip'><span class='glyphicon glyphicon-pencil'></span></a>  ";
                                                        echo "<a href='delete.php?id=". $row['a_asset'] ."' title='Delete Record' data-toggle='tooltip'><span class='glyphicon glyphicon-trash'></span></a>";
                                                        echo "</td>";
                                                        echo "</tr>";
                                                    }
                                                    echo "</tbody>";
                                                    echo "</table>";
                                                    // Free result set
                                                    mysqli_free_result($result);
                                                } else{
                                                    echo "<p class='lead'><em>No records were found.</em></p>";
                                                }
                                            } else{
                                                echo "ERROR: Could not able to execute $sql. " . mysqli_error($db);
                                            }

                                            // Close connection
                                            mysqli_close($db);
                                            ?>
                                        </div>
                                    </div>
                                </div>
                            </div>
</body>
</html>                  </div>
</div>
</div>
</div>
</div>
</div>

知道我能做些什么吗?

这是我唯一的问题,我现在只需要添加更多文字。

或者,好吧,如果你们想给我一些提示,使全局搜索功能也很好。比如,能够搜索所有列的信息。虽然我很确定它并不那么难。

我想知道......我还需要调查如何按名称或创建日期对结果进行排序。

谢谢大家!

0 个答案:

没有答案