update multiple rows of one column by single submit button : AngularJS with PHP -
i need update column (fraisfact) of several lines, each line identifier (codecompletecolumn), how can angularjs , php knowing managed display inofrmation of each code ( ng-repeat) , can not predict number of codes displayed , have update "fraisfact" of each "codeenvoicolis" fichier.html
<ion-list ng-repeat="x in namesf3 " > <div class="item item-divider center-text" name="codee" ng-model="codee" value={{x.codeenvoicolis}} > {{x.codeenvoicolis}} </div> <label class="item item-input"> <input type="text" placeholder="frais" name="frais" ng-model="frais"></div> </label> </ion-list> <a class="button button-info" href="#/factureadmin" ng- click=updatefactfact(x.frais)> ajouter </a>
app.js :
$scope.insertfact = function(frais){ $http.post( "http://localhost/deb/updatefact.php", { 'frais':$scope.frais, 'codee':$scope.codee, } ).success(function(data){ alert(data); $scope.frais=null; $scope.codee=null; }); }
updatefact.php
<?php $connect = mysqli_connect("localhost", "root", "", "sem1"); $data = json_decode(file_get_contents("php://input")); if(count($data) > 0) { $fraisfact = mysqli_real_escape_string($connect, $data->frais); $codeenvoicolis = mysqli_real_escape_string($connect, $data->codee); $query = "update colis set fraisfact='.$fraisfact.' codeenvoicolis='.$codeenvoicolis'"; } ?>
Comments
Post a Comment