Php 使用angularJS的可编辑表格单元格
是否有一种方法可以在Php 使用angularJS的可编辑表格单元格,php,mysql,angularjs,Php,Mysql,Angularjs,是否有一种方法可以在td中显示数据,并允许用户以sql(在我的例子中是MySQL)表中发生更改的方式对其进行编辑? 我正在使用angularJS从数据库创建一个表: 从表中创建json文件: $result = mysql_query("select * from `user script settings`"); //Create an array $json_response = array(); while ($row = mysql_fetch_array($result, MYSQL
td
中显示数据,并允许用户以sql(在我的例子中是MySQL)表中发生更改的方式对其进行编辑?
我正在使用angularJS从数据库创建一个表:
从表中创建json文件:
$result = mysql_query("select * from `user script settings`");
//Create an array
$json_response = array();
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
$row_array['user_id'] = $row['user id'];
$row_array['script_id'] = $row['script id'];
$row_array['cron_format'] = $row['cron format'];
$row_array['schedule_last_update'] = $row['schedule last update'];
$row_array['next_execution_time'] = $row['next execution time'];
$row_array['script_exec'] = $row['script_exec'];
//push the values in the array
array_push($json_response,$row_array);
}
echo json_encode($json_response);
<table class="table table-bordered table-hover">
<thead>
<td>user name</td>
<td>script name</td>
<td>cron format</td>
<td>schedule last update</td>
<td>next execution time</td>
<td>script exec</td>
</thead>
<tbody>
<tr ng-repeat="x in data">
<td>{{x.user_id}}</td>
<td>{{x.script_id}}</td>
<td>{{x.cron_format}}</td>
<td>{{x.schedule_last_update}}</td>
<td>{{x.next_execution_time}}</td>
<td>{{x.script_exec}}</td>
</tr>
</tbody>
</table>
<script>
function customersController($scope,$http) {
$http.get("getData.php")//test3.php return a json file of users table
.success(function(response) {$scope.data = response;});
}
</script>
在表格中显示:
$result = mysql_query("select * from `user script settings`");
//Create an array
$json_response = array();
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
$row_array['user_id'] = $row['user id'];
$row_array['script_id'] = $row['script id'];
$row_array['cron_format'] = $row['cron format'];
$row_array['schedule_last_update'] = $row['schedule last update'];
$row_array['next_execution_time'] = $row['next execution time'];
$row_array['script_exec'] = $row['script_exec'];
//push the values in the array
array_push($json_response,$row_array);
}
echo json_encode($json_response);
<table class="table table-bordered table-hover">
<thead>
<td>user name</td>
<td>script name</td>
<td>cron format</td>
<td>schedule last update</td>
<td>next execution time</td>
<td>script exec</td>
</thead>
<tbody>
<tr ng-repeat="x in data">
<td>{{x.user_id}}</td>
<td>{{x.script_id}}</td>
<td>{{x.cron_format}}</td>
<td>{{x.schedule_last_update}}</td>
<td>{{x.next_execution_time}}</td>
<td>{{x.script_exec}}</td>
</tr>
</tbody>
</table>
<script>
function customersController($scope,$http) {
$http.get("getData.php")//test3.php return a json file of users table
.success(function(response) {$scope.data = response;});
}
</script>
用户名
脚本名
cron格式
计划最后更新
下次执行时间
脚本执行器
{{x.user_id}
{{x.script_id}
{{x.cron_format}}
{{x.schedule\u last\u update}
{{x.next_execution_time}
{{x.script_exec}
函数customersController($scope,$http){
$http.get(“getData.php”)//test3.php返回用户表的json文件
.success(函数(响应){$scope.data=response;});
}
我想允许用户更改cron格式值并更新表…是否有“angularish”的方法来实现这一点??如果不是的话,我将感谢您对php解决方案的指导,谢谢 检查如下内容:在示例的doneEditing
方法中,更新sql表。