获取三层信息:
该层包含具有UNIQUE自然索引的数据和可轻松转移的代理键.
Table Surnames:
+-----------------------------+--------------+
| ID (Auto Increment, PK) | Surname |
+-----------------------------+--------------+
| 1 | Smith |
| 2 | Edwards |
| 3 | Brown |
+-----------------------------+--------------+
Table FirstNames
+-----------------------------+--------------+
| ID (Auto Increment, PK) | FirstName |
+-----------------------------+--------------+
| 1 | John |
| 2 | Bob |
| 3 | Mary |
| 4 | Kate |
+-----------------------------+--------------+
Run Code Online (Sandbox Code Playgroud)
自然键
或者,上面的两个表可以没有,ID并使用Surname和FirstName作为自然主键,正如Mike Sherrill所解释的那样.在这种情况下,假设下面的层引用varchar而不是int.
在该层中,使用复合索引.该值可以是UNIQUE或PRIMARY …
我有一个非常奇怪的错误.
在我的本地xampp的环境中,删除操作工作得很好,代码完全相同,数据库相同......但是托管它不起作用.
码:
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<script src="//cdn.datatables.net/1.10.9/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/1.10.9/js/dataTables.bootstrap.min.js"></script>
<script src="https://cdn.datatables.net/responsive/2.0.0/js/dataTables.responsive.min.js"></script>
<script>
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
</script>
<script type="text/javascript">
var theGrid = null;
$(document).ready(function(){
theGrid = $('#thegrid').DataTable({
"processing": true,
"serverSide": true,
"ordering": true,
"responsive": true,
"ajax": "http://eindeks.000webhostapp.com/przedmioties/grid",
"columnDefs": [
{
"render": function ( data, type, row ) {
return '<a href="http://eindeks.000webhostapp.com/przedmioties/'+row[0]+'">'+data+'</a>';
},
"targets": 1
}, …Run Code Online (Sandbox Code Playgroud)