Javascript 一个Php页面。。多个Angularjs表
我无法在一个php页面中显示两个不同的表。。。。我在第一个表中得到正确的输出,但在第二个表中得到错误。。。 请帮帮我 这是我的index.php代码Javascript 一个Php页面。。多个Angularjs表,javascript,php,mysql,angularjs,Javascript,Php,Mysql,Angularjs,我无法在一个php页面中显示两个不同的表。。。。我在第一个表中得到正确的输出,但在第二个表中得到错误。。。 请帮帮我 这是我的index.php代码 <div ng-app="myApp" ng-app lang="en"> <h4>Main Info Sheet</h4> <div ng-controller="customersCrtl"> <div class="container"> <br/>
<div ng-app="myApp" ng-app lang="en">
<h4>Main Info Sheet</h4>
<div ng-controller="customersCrtl">
<div class="container">
<br/>
<div class="row">
<div class="col-md-2">PageSize:
<select ng-model="entryLimit" class="form-control">
<option>5</option>
<option>10</option>
<option>20</option>
<option>50</option>
<option>100</option>
</select>
</div>
<div class="col-md-3">Filter:
<input type="text" ng-model="search" ng-change="filter()" placeholder="Filter" class="form-control" />
</div>
<div class="col-md-4">
<h5>Filtered {{ filtered.length }} of {{ totalItems}} total Passports</h5>
</div>
</div>
<div class="row">
<div class="" style="white-space:pre; overflow:auto; width:auto; padding-left:5px;">
<div class="col-md-12" ng-show="filteredItems > 0">
<table class="table table-striped table-bordered">
<thead>
<th>Passport Number <a ng-click="sort_by('ppnumber');"><i class="glyphicon glyphicon-sort"></i></a></th>
<th>First Name <a ng-click="sort_by('fname');"><i class="glyphicon glyphicon-sort"></i></a></th>
<th>Last Name <a ng-click="sort_by('lname');"><i class="glyphicon glyphicon-sort"></i></a></th>
<th>Phone Number <a ng-click="sort_by('cpnumber');"><i class="glyphicon glyphicon-sort"></i></a></th>
</thead>
<tbody>
<tr ng-repeat="data in filtered = (list | filter:search | orderBy : predicate :reverse) | startFrom:(currentPage-1)*entryLimit | limitTo:entryLimit">
<td>{{data.ppnumber}}</td>
<td>{{data.fname}}</td>
<td>{{data.lname}}</td>
<td>{{data.cpnumber}}</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="col-md-12" ng-show="filteredItems == 0">
<div class="col-md-12">
<h4>No Data Found</h4>
</div>
</div>
<div class="col-md-12" ng-show="filteredItems > 0">
<div pagination="" page="currentPage" on-select-page="setPage(page)" boundary-links="true" total-items="filteredItems" items-per-page="entryLimit" class="pagination-small" previous-text="«" next-text="»"></div>
</div>
</div>
</div>
</div>
getCustomers.php
<?php
include('../includes/config.php');
$query="SELECT DISTINCT ppnumber, fname, lname, cpnumber FROM mainsheetinfo";
$result = $mysqli->query($query) or die($mysqli->error.__LINE__);
$arr = array();
if($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
$arr[] = $row;
}
}
$json_response = json_encode($arr);
echo $json_response;
?>
上述代码工作正常。。但类似地,我想显示另一个mysql表中的另一个表
这里我附上两张图片。。第一张桌子很好用。。。但不是在第二张桌子上
这是第二张桌子
只需将ng应用程序放在body标签中。。然后可以访问多个表
<body ng-app="myApp" ng-app lang="en">
<h4>Main Info Sheet</h4>
<div ng-controller="customersCrtl">
<div class="container">
<br/>
<div class="row">
<div class="col-md-2">PageSize:
<select ng-model="entryLimit" class="form-control">
<option>5</option>
<option>10</option>
<option>20</option>
<option>50</option>
<option>100</option>
</select>
</div>
<div class="col-md-3">Filter:
<input type="text" ng-model="search" ng-change="filter()" placeholder="Filter" class="form-control" />
</div>
<div class="col-md-4">
<h5>Filtered {{ filtered.length }} of {{ totalItems}} total Passports</h5>
</div>
</div>
<div class="row">
<div class="" style="white-space:pre; overflow:auto; width:auto; padding-left:5px;">
<div class="col-md-12" ng-show="filteredItems > 0">
<table class="table table-striped table-bordered">
<thead>
<th>Passport Number <a ng-click="sort_by('ppnumber');"><i class="glyphicon glyphicon-sort"></i></a></th>
<th>First Name <a ng-click="sort_by('fname');"><i class="glyphicon glyphicon-sort"></i></a></th>
<th>Last Name <a ng-click="sort_by('lname');"><i class="glyphicon glyphicon-sort"></i></a></th>
<th>Phone Number <a ng-click="sort_by('cpnumber');"><i class="glyphicon glyphicon-sort"></i></a></th>
</thead>
<tbody>
<tr ng-repeat="data in filtered = (list | filter:search | orderBy : predicate :reverse) | startFrom:(currentPage-1)*entryLimit | limitTo:entryLimit">
<td>{{data.ppnumber}}</td>
<td>{{data.fname}}</td>
<td>{{data.lname}}</td>
<td>{{data.cpnumber}}</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="col-md-12" ng-show="filteredItems == 0">
<div class="col-md-12">
<h4>No Data Found</h4>
</div>
</div>
<div class="col-md-12" ng-show="filteredItems > 0">
<div pagination="" page="currentPage" on-select-page="setPage(page)" boundary-links="true" total-items="filteredItems" items-per-page="entryLimit" class="pagination-small" previous-text="«" next-text="»"></div>
</div>
</div>
</div>
</body>
您收到了什么错误?先生。。第二个图像中出现错误。。。无法在“客户端详细信息”选项卡中检索db表。。但使用我在主工作表选项卡中检索的相同代码。。。这是在第一个图像中…我试图更改为in index.php和var app=angular.module'myApp',['ui.bootstrap'];到var app=angular.module'test',['ui.bootstrap'];在app.js中,但它不起作用。。请帮助..你能从另一个查询中转储数据吗。。及其工作原理
<body ng-app="myApp" ng-app lang="en">
<h4>Main Info Sheet</h4>
<div ng-controller="customersCrtl">
<div class="container">
<br/>
<div class="row">
<div class="col-md-2">PageSize:
<select ng-model="entryLimit" class="form-control">
<option>5</option>
<option>10</option>
<option>20</option>
<option>50</option>
<option>100</option>
</select>
</div>
<div class="col-md-3">Filter:
<input type="text" ng-model="search" ng-change="filter()" placeholder="Filter" class="form-control" />
</div>
<div class="col-md-4">
<h5>Filtered {{ filtered.length }} of {{ totalItems}} total Passports</h5>
</div>
</div>
<div class="row">
<div class="" style="white-space:pre; overflow:auto; width:auto; padding-left:5px;">
<div class="col-md-12" ng-show="filteredItems > 0">
<table class="table table-striped table-bordered">
<thead>
<th>Passport Number <a ng-click="sort_by('ppnumber');"><i class="glyphicon glyphicon-sort"></i></a></th>
<th>First Name <a ng-click="sort_by('fname');"><i class="glyphicon glyphicon-sort"></i></a></th>
<th>Last Name <a ng-click="sort_by('lname');"><i class="glyphicon glyphicon-sort"></i></a></th>
<th>Phone Number <a ng-click="sort_by('cpnumber');"><i class="glyphicon glyphicon-sort"></i></a></th>
</thead>
<tbody>
<tr ng-repeat="data in filtered = (list | filter:search | orderBy : predicate :reverse) | startFrom:(currentPage-1)*entryLimit | limitTo:entryLimit">
<td>{{data.ppnumber}}</td>
<td>{{data.fname}}</td>
<td>{{data.lname}}</td>
<td>{{data.cpnumber}}</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="col-md-12" ng-show="filteredItems == 0">
<div class="col-md-12">
<h4>No Data Found</h4>
</div>
</div>
<div class="col-md-12" ng-show="filteredItems > 0">
<div pagination="" page="currentPage" on-select-page="setPage(page)" boundary-links="true" total-items="filteredItems" items-per-page="entryLimit" class="pagination-small" previous-text="«" next-text="»"></div>
</div>
</div>
</div>
</body>