php - 如何使用折叠/展开选项制作 jQuery 数据表 mysql php
问题描述
如何使用 mysql php 使 jQuery 数据表折叠/展开选项
我不想选择 ajax 选项,因为在查看源代码 fetch.php 页面可以看到我不知道保护它的数据。当打开 php 页面的人可以读取所有数据时。所以去其他方法。
但是有人帮我折叠/展开
$(document).ready(function(){
$('#employee_data').DataTable();
});
<?php
$connect = mysqli_connect("localhost", "root", "", "testing");
$query ="SELECT * FROM tbl_employee ORDER BY ID DESC";
$result = mysqli_query($connect, $query);
?>
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" />
<script src="https://cdn.datatables.net/1.10.12/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/1.10.12/js/dataTables.bootstrap.min.js"></script>
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.12/css/dataTables.bootstrap.min.css" />
</head>
<body>
<br /><br />
<div class="container">
<h3 align="center">Datatables Jquery Plugin with Php MySql and Bootstrap</h3>
<br />
<div class="table-responsive">
<table id="employee_data" class="table table-striped table-bordered">
<thead>
<tr>
<td>Name</td>
<td>Address</td>
<td>Gender</td>
<td>Designation</td>
<td>Age</td>
</tr>
</thead>
<?php
while($row = mysqli_fetch_array($result))
{
echo '
<tr>
<td>'.$row["name"].'</td>
<td>'.$row["address"].'</td>
<td>'.$row["gender"].'</td>
<td>'.$row["designation"].'</td>
<td>'.$row["age"].'</td>
</tr>
';
}
?>
</table>
</div>
</div>
</body>
</html>
解决方案
推荐阅读
- c# - IServiceProvider 解析动态类型
- xml - XPath 通过多个 ID 输出整个 XML
- r - R编程,For循环,if else语句未返回中位数的正确计算
- android - 无法删除 Android 联系人中的特定号码
- firebase - 制作apk后通知声音在android上不起作用
- python - 如何将参数从 Python 传递给 mysql 并根据这些参数从 mysql 获得响应?
- javascript - 用不同的颜色绘制活动类别
- java - Selenium Cucumber:功能文件无法通过运行器类找到步骤定义
- reactjs - Storybook 在侧边栏中添加自定义文本
- python - 如何在pytorch中找到偏导数