Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/289.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/date/2.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中的数据显示时分页消失_Php_Mysql_Datatables - Fatal编程技术网

Php-搜索框,当MySQL中的数据显示时分页消失

Php-搜索框,当MySQL中的数据显示时分页消失,php,mysql,datatables,Php,Mysql,Datatables,我再也不知道如何解决这个问题了,数据表的组件已经消失了:搜索框、分页、长度数 我认为这是我在PHP代码中造成的,但事实并非如此 显示了许多错误,id=example,error JSON responseSecond oneAJAX error 现在我发现了这个,这就是为什么我现在问我的问题 下面的代码只显示了名称,但表中的其他组件不见了 <table cellpadding="1" cellspacing="1" id="datatable" class="display" width=

我再也不知道如何解决这个问题了,数据表的组件已经消失了:搜索框、分页、长度数

我认为这是我在PHP代码中造成的,但事实并非如此

显示了许多错误,
id=example,error JSON response
Second one
AJAX error

现在我发现了这个,这就是为什么我现在问我的问题

下面的代码只显示了
名称
,但表中的其他组件不见了

<table cellpadding="1" cellspacing="1" id="datatable" class="display" width="100%">
                <thead>
                <tr>
                    <th>Name</th>
                    <th>Phone</th>
                    <th>City</th>
                    <th>Email</th>
                </tr>
                </thead>
                <tbody>
                <?php
                require_once("Connection.php");
                $connection = new Connection();
                $conn = $connection->getConnection();
                try{
                    $sql = "SELECT * FROM identitas";
                    $getData = $conn->prepare($sql);
                    $getData->execute();
                    $result = $getData->fetchAll(PDO::FETCH_ASSOC);
                    foreach($result as $data){
                        ?>
                        <tr>
                            <td><?php echo $data['nama']?></td>
                        </tr>
                        <?php
                    }
                }catch(PDOException $e){
                    echo "ERROR : " . $e->getMessage();
                }
                ?>
                </tbody>
                <tfoot>
                <tr>
                    <th>Name</th>
                    <th>Phone</th>
                    <th>City</th>
                    <th>Email</th>
                </tr>
                </tfoot>
            </table>
 <!-- for data table-->
        <link rel="stylesheet" type="text/css" href="DataTables-1.10.11/media/css/jquery.dataTables.css">
        <script type="text/javascript" src="DataTables-1.10.11/media/js/jquery-1.12.1.min.js"></script>
        <script type="text/javascript" src="DataTables-1.10.11/media/js/jquery.dataTables.min.js"></script>


        <!-- javascript-->
        <script type="text/javascript">

            $(document).ready(function(){
                $('#datatable').dataTable({
                    "dom": '<"top"fl>rt<"bottom"ip><"clear">'
                });
            });
      </script>