I want to update my table, and i have script in php page on my server for getting value like this
<div ng-controller="customersCrtl">
<div class="container">
<form method="post" action="update_mul.php">
<td><input type="hidden" name="Id[]" value="{{data.Id}}" />{{data.Region}}</td>
<td><input type="text" name="sii[]" value="{{data.Site_ID_Implementation}}"/></td>
</form>
</div>
</div>
and my update page is
<?php
include_once 'connect.php';
$id = $_POST['Id'];
$sii = $_POST['sii'];
$chkcount = count($id);
for($i=0; $i<$chkcount; $i++)
{
echo $mysqli->query("UPDATE WS_Manado SET Site_ID_Implementation = '".$sii[$i]."'
WHERE Id=".$id[$i]);
}
?>
But this doesn't work, no error messagese or other just back to first page
Firstly if i use <?php echo $row['Site_ID_Implementation'];?>
on value, it's working
UPDATE app.js
var app = angular.module('myApp', ['ui.bootstrap']);
app.filter('startFrom', function() {
return function(input, start) {
if(input) {
start = +start; //parse to int
return input.slice(start);
}
return [];
}
});
app.controller('customersCrtl', function ($scope, $http, $timeout) {
$http.get('ajax/getCustomers.php').success(function(data){
$scope.list = data;
$scope.currentPage = 1; //current page
$scope.entryLimit = 100; //max no of items to display in a page
$scope.filteredItems = $scope.list.length; //Initially for no filter
$scope.totalItems = $scope.list.length;
});
$scope.setPage = function(pageNo) {
$scope.currentPage = pageNo;
};
$scope.filter = function() {
$timeout(function() {
$scope.filteredItems = $scope.filtered.length;
}, 10);
};
$scope.sort_by = function(predicate) {
$scope.predicate = predicate;
$scope.reverse = !$scope.reverse;
};
});
getCustomers.php
<?php
include('../connect.php');
$query="select distinct c.Region,c.Category,c.Site_ID_Implementation from WS_Manado c order by c.Id";
$result = $mysqli->query($query) or die($mysqli->error.__LINE__);
$arr = array();
if($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
$arr[] = $row;
}
}
# JSON-encode the response
$json_response = json_encode($arr);
// # Return the response
echo $json_response;
?>