我正试图在bootstrap中创建一个表,但是数组有欺负我的倾向:P
我有2个文件。我的index.php表的代码和javascript是,然后我有我的list-user.php,其中所有后端的东西都是。
不知怎的,它不起作用。我没有任何错误,在我的世界中代码应该工作。但表中所说的只是:“找不到匹配的记录”。
网站链接:http://spionerne.com/politi/test/
的index.php:
<html>
<head>
<title> Bootstrap Table</title>
<link type="text/css" href="css/bootstrap.min.css" rel="stylesheet">
<link type="text/css" href="css/bootstrap-table.css" rel="stylesheet">
<link type="text/css" href="css/font-awesome.css" rel="stylesheet">
</head>
<body>
<div class="container">
<div class="col-md-12">
<div class="page-header">
<h1>
TEST
</h1>
</div>
<div class="panel panel-success">
<div class="panel-heading ">
</div>
<div class="panel-body">
<div class="row">
<div class="col-md-12">
<table id="table"
data-show-columns="true"
data-height="460">
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="js/jquery-1.11.1.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/bootstrap-table.js"></script>
<script type="text/javascript">
var $table = $('#table');
$table.bootstrapTable({
url: 'list-user.php',
search: true,
pagination: true,
buttonsClass: 'primary',
showFooter: true,
minimumCountColumns: 2,
columns: [{
field: 'id',
title: 'Sagsnummer',
sortable: true,
},{
field: 'navn',
title: 'Navn',
sortable: true,
},{
field: 'grund',
title: 'Grunden',
sortable: true,
},{
field: 'tid',
title: 'Tid',
sortable: true,
},{
field: 'betjent',
title: 'Betjent',
sortable: true,
}, ],
});
</script>
</body>
</html>
列表users.php
require 'db.php';
$sqltran = mysqli_query($con, "SELECT * FROM anholdelser ") or die(mysqli_error($con));
$arrVal = array();
$i = 1;
while ($rowList = mysqli_fetch_array($sqltran)) {
$name = array(
'id' => $i,
'navn' => $rowList['navn'],
'grund' => $rowList['grunden'],
'tid' => $rowList['tid'],
'betjent' => $rowList['politmanden']
);
array_push($arrVal, $name);
$i++;
}
echo json_encode($arrVal);
mysqli_close($con);
答案 0 :(得分:0)