Php-搜索框,当MySQL中的数据显示时分页消失
我再也不知道如何解决这个问题了,数据表的组件已经消失了:搜索框、分页、长度数 我认为这是我在PHP代码中造成的,但事实并非如此 显示了许多错误,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=
id=example,error JSON response
Second oneAJAX 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>