虽然获取记录会提供所有记录,但是在1年后,它只会提供2条记录。当数据库中只有2条记录时,它工作正常,但是当记录从2条增加时,它表示当我删除所有记录并在数据库中仅保留2条记录时,找不到任何记录,然后它在html
表中显示数据。
我的php
代码是
<?php
require '../db.php';
$sqltran = mysqli_query($con, "SELECT * FROM `abcd` where form='Normal' ORDER BY case_id DESC")or die(mysqli_error($con));
$arrVal = array();
$i=1;
while ($rowList = mysqli_fetch_array($sqltran)) {
$name = array(
'num' =>$i,
'ins_id'=> $rowList['ins_id'],
'date'=> $rowList['d_visit'],
'name'=> $rowList['cname'],
'address'=> $rowList['c_address'],
);
array_push($arrVal, $name);
$i++;
}
echo json_encode($arrVal);
mysqli_close($con);
?>
我的html
代码
<div class="row clearfix">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<div class="card">
<div class="header">
<form action="export1.php" method="post">
<div style="float:right"> <button type="submit" id="export" name="export" class="btn btn-primary button-loading" data-loading-text="Loading...">Export Data to Excel File</button></div>
</form>
<h2>
Normal
</h2>
</div>
<div class="body table-responsive">
<table id="table"
data-show-columns="true">
</table>
</div>
</div>
</div>
<script type="text/javascript">
var $table = $('#table');
$table.bootstrapTable({
url:'fadvaddress/search2.1.php',
search: true,
pagination: true,
pageSize:20,
pageList: [5, 10, 25, 50, 100, 200, 500],
cache: true,
condensed:true,
hover:true,
buttonsClass: 'danger',
showFooter: false,
minimumCountColumns: 2,
columns: [{
field: 'num',
title: '#',
sortable: true,
},{
field: 'ins_id',
title: 'Instruction id No.',
sortable: true,
},{
field: 'date',
title: 'Date of Visit',
sortable: true,
},
{
field: 'name',
title: 'Name Of the Candidate',
sortable: true,
},
{
field: 'address',
title: 'Address of the Candidate',
sortable: true,
},
],
});
在html
中,我使用bootstrap css
来显示表格