问题是
Applications/XAMPP/xamppfiles/htdocs/middlework/administration/dash.php</b> on line <b>225</b><br />
DELETE FROM `cafe` WHERE cafe_id=;Error
你可以看到[WHERE cafe_id =;]没有值,它发送“”到php文件然后php无法完成他们的工作。
以下是我的代码:
$scope.deleteData = function (cafe_id) {
var path = $scope.path + '?n=' + $scope.table + '&id="' + cafe_id + '"&action=delete' + '&app=true';
$http.get(path)
.then(function (response) {
//First function handles success
// $scope.getData();
}, function (response) {
//Second function handles error
$scope.content = "Something went wrong";
});
}
$scope.getData = function () {
$scope.table = "cafe";
var path = $scope.path + '?n=' + $scope.table + '&app=true';
$http.get(path)
.then(function (response) {
//First function handles success
$scope.content = response.data;
$scope.update = false;
$scope.reset();
}, function (response) {
//Second function handles error
$scope.content = "Something went wrong";
});
}
html部分
<table method="post" border="1" ng-init="getData();">
<tr ng-repeat="x in content">
<td>{{x.cafe_id}}</td>
<td>{{x.Username}}</td>
<td>{{x.CafeName}}</td>
<td><button ng-click="editData(x.id)" >Edit</button></td>
<td><button ng-click="deleteData(x.cafe_id)" >Del</button></td>
</tr>
</table>