DataTables 不能读取多个数据

DataTables can't read more than one Data

我想问一下,为什么DataTable 不能在我的数据库中读取超过1 个数据?我将不胜感激任何帮助,因为我对数据 Table 比较陌生,谢谢。

如您所见,它只显示 1 到 1 个条目,共 1 个条目。但是正如在 table 中看到的,我有 5 个检索到的数据。

当我尝试在搜索栏中搜索时,出现了这个。

这是 table 的代码。

<table class="table table-striped table-hover table-condense" id="tbl_research">
                <thead>
                    <tr>
                    <th scope="col">#</th>
                    <th scope="col">Resarch Title</th>
                    <th scope="col">Research Type</th>
                    <th scope="col">Research Author</th>
                    <th scope="col">Action</th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                    <?php
                    include 'includes/connection_operation.php';
                    $sql = "SELECT * FROM tbl_repository";
                    $query = mysqli_query($conn,$sql);

                    if($query)
                    {
                        while($row = mysqli_fetch_assoc($query))
                        {
                            ?>
                    <th><?php echo $row['ID']; ?></th>
                    <td><?php echo $row['research_title']; ?></td>
                    <td><?php echo $row['research_type']; ?></td>
                    <td><?php echo $row['research_author']; ?></td>
                    <td>
                        <input type="submit" name="submit" id="submit" value="View" class="btn btn-info" 
                        data-toggle="modal" data-target="#viewResearchModal<?php echo $row["ID"];?>">
                    </td>
                    </tr>
                </tbody>
                
                <?php 
                include './helper/modal_viewresearch.php';
                    }
                }
                ?>
                </table>

这是我的 plugins/cdn

代码
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">

    <title>CRR | View Research</title>
    
    <!-- Bootstrap CSS CDN -->
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css" integrity="sha384-9gVQ4dYFwwWSjIDZnLEWnxCjeSWFphJiwGPXr1jddIhOegiu1FwO5qRGvFXOdJZ4" crossorigin="anonymous">
    <!-- Our Custom CSS -->
    <link rel="stylesheet" href="css/style.css">
    <link rel="stylesheet" href="https://cdn.datatables.net/1.10.23/css/jquery.dataTables.min.css">
    

    <!-- Font Awesome JS -->
    <script defer src="https://use.fontawesome.com/releases/v5.0.13/js/solid.js" integrity="sha384-tzzSw1/Vo+0N5UhStP3bvwWPq+uvzCMfrN1fEFe+xBmv1C/AtVX5K0uZtmcHitFZ" crossorigin="anonymous"></script>
    <script defer src="https://use.fontawesome.com/releases/v5.0.13/js/fontawesome.js" integrity="sha384-6OIrr52G08NpOFSZdxxz1xdNSndlD4vdcf/q2myIUVO0VsqaGHJsB0RaBE01VTOY" crossorigin="anonymous"></script>
</head>

<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.0/umd/popper.min.js" integrity="sha384-cs/chFZiN24E4KMATLdqdvsezGxaGsi4hLGOzlXwp5UZB1LY//20VyM2taTB4QvJ" crossorigin="anonymous"></script>
    <!-- Bootstrap JS -->
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js" integrity="sha384-uefMccjFJAIv6A+rW+L4AHf99KvxDjWSu1z9VI8SKNVmz4sk7buKt/6v9KI65qnm" crossorigin="anonymous"></script>
    <script src="https://code.jquery.com/jquery-3.5.1.js"></script>
    <script src="https://cdn.datatables.net/1.10.23/js/jquery.dataTables.min.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $('#sidebarCollapse').on('click', function () {
                $('#sidebar').toggleClass('active');
            });
        });
    </script>
    <script>
        $(document).ready(function() {
        $(function () {
            $('[data-toggle="popover"]').popover()
        });

        $(function () {
            $('[data-toggle="tooltip"]').tooltip()
        })
        });
    </script>
    <script>
        $(document).ready(function() {
        $('#tbl_research').DataTable( {
        } );
    } );
    </script>
</body>

</html>

我不得不重新阅读我的整个代码 3 次,它只显示 1 的原因是 tbody 在循环内,所以它只看到 1。我不得不将它移到 while 循环之外,所以数据应该在一个 tbody 中谢谢。