表格
<table id="grid-data" class="table table-condensed table-hover table-striped">
<thead>
<tr>
<th data-column-id="id" >Project Name</th>
<th data-column-id="sender">Project Description</th>
<th data-column-id="received" data-order="desc">Project Client</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
JQuery
<script>
$( document ).ready(function() {
$("#grid-data").bootgrid({
ajax: true,
url: "view.php"
});
});
</script>
view.php
<?php
$conn = mysqli_connect("localhost", "root", "", "crudphp");
$query ="SELECT * FROM records ORDER BY id DESC";
$stmt = $conn->prepare("SELECT id,project_name,project_description,project_client FROM records ORDER BY id DESC ");
$stmt->bind_result($id,$project_name,$project_description,$project_client);
if ($stmt->execute()) {
while ( $stmt->fetch() ) {
$output[] = array ("id"=>$id,"project_name"=>$project_name,"project_description"=>$project_description,"project_client"=>$project_client);
}
echo json_encode( $output );
}
$stmt->close();
?>