Javascript php mysql jquery:加载资源失败:服务器响应状态为500(内部服务器错误)
我创建了两个程序,一个是包含数据表布局的html,另一个是包含基于对象的PHP程序的PHP文件 当我跑步的时候,我会变得越来越强壮 加载资源失败:服务器响应状态为500(内部服务器错误) 我无法在PHP脚本中找到错误,因为我是初学者。请看下面的程序并帮助我解决问题 index.htmlJavascript php mysql jquery:加载资源失败:服务器响应状态为500(内部服务器错误),javascript,php,jquery,html,mysql,Javascript,Php,Jquery,Html,Mysql,我创建了两个程序,一个是包含数据表布局的html,另一个是包含基于对象的PHP程序的PHP文件 当我跑步的时候,我会变得越来越强壮 加载资源失败:服务器响应状态为500(内部服务器错误) 我无法在PHP脚本中找到错误,因为我是初学者。请看下面的程序并帮助我解决问题 index.html <!DOCTYPE html> <html> <head> <title>Tracker</title> <link rel="
<!DOCTYPE html>
<html>
<head>
<title>Tracker</title>
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
<style type="text/css">
.modal-dialog, .modal-content{
z-index:1051;
}
</style>
<script type="text/javascript" src="http://markcell.github.io/jquery-tabledit/assets/js/jquery.min.js"></script>
<script type="text/javascript" src="http://markcell.github.io/jquery-tabledit/assets/js/bootstrap.min.js"></script>
<script type="text/javascript" src="http://markcell.github.io/jquery-tabledit/assets/js/prettify.min.js"></script>
<script type="text/javascript" src="jquery.tabledit.js"></script>
</head>
<body onload="viewData()">
<div class="container">
<br>
<br>
<table class="table table-striped table-bordered" id="usertrackertable">
<thead class="tabledit-toolbar-column">
<tr>
<th>Id</th>
<th>Ticket No</th>
<th>Full Name</th>
<th>Emp Id</th>
<th>Mail</th>
<th>Member Type</th>
<th>Location</th>
<th>Request Type</th>
<th>Asset Type</th>
<th>Asset No</th>
<th>Serial No</th>
<th>Model</th>
<th>Comments</th>
<th>Status</th>
<th class=tabledit-toolbar-column></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
<script type="text/javascript">
function viewData(){
$.ajax({
url:'example.php?p=view',
method: 'GET'
}).done(function(data){
$('usertrackertable').html(data)
tableData()
})
}
function tableData(){
$('#usertrackertable').Tabledit({
url: 'example.php',
columns: {
identifier: [0, 'id'],
editable: [[1, 'Ticket No'], [2, 'firstname'], [3, 'lastname']]
}
});
}
</script>
</body>
</html>
跟踪器
.modal对话框,.modal内容{
z指数:1051;
}
身份证件
车票号码
全名
Emp Id
邮寄
成员类型
位置
请求类型
资产类型
资产编号
序列号
模型
评论
地位
函数viewData(){
$.ajax({
url:'example.php?p=view',
方法:“获取”
}).完成(功能(数据){
$('usertrackertable').html(数据)
tableData()
})
}
函数tableData(){
$('#usertrackertable').Tabledit({
url:'example.php',
栏目:{
标识符:[0,'id'],
可编辑:[[1,‘票号’],[2,‘姓氏’,[3,‘姓氏’]]
}
});
}
example.php
<?php
// Basic example of PHP script to handle with jQuery-Tabledit plug-in.
// Note that is just an example. Should take precautions such as filtering the input data.
header('Content-Type: application/json');
$mysqli = mysqli('localhost', 'root', 'admin', 'ham');
if (mysqli_connect_errno()) {
echo json_encode(array('mysqli' => 'Failed to connect to MySQL: ' . mysqli_connect_error()));
exit;
}
$page= isset($_GET['p'])? $_GET['p'] : '' ;
if($page=='view'){
$result=$mysqli->query("SELECT id, ticket_no, full_name, emp_id, emp_mail, member_type, member_location, request_type, asset_type, asset_number, serial_number, asset_model_number, remarks_comments, timestamp, status FROM HAMTRACKER WHERE is_flagged != '1';");
while($row= $result->fetch_assoc()){
?>
<tr>
<td><?php echo $row['id'] ?></td>
<td><?php echo $row['ticket_no'] ?></td>
<td><?php echo $row['full_name'] ?></td>
<td><?php echo $row['emp_id'] ?></td>
<td><?php echo $row['emp_mail'] ?></td>
<td><?php echo $row['member_type'] ?></td>
<td><?php echo $row['member_location'] ?></td>
<td><?php echo $row['request_type'] ?></td>
<td><?php echo $row['asset_type'] ?></td>
<td><?php echo $row['asset_number'] ?></td>
<td><?php echo $row['serial_number'] ?></td>
<td><?php echo $row['asset_model_number'] ?></td>
<td><?php echo $row['remarks_comments'] ?></td>
<td><?php echo $row['timestamp'] ?></td>
<td><?php echo $row['status'] ?></td>
</tr>
<?php
}
}else{
$input = filter_input_array(INPUT_POST);
if ($input['action'] === 'edit') {
$mysqli->query("UPDATE hamtracker SET ticket_no='" . $input['tickettb'] . "',
full_name='" . $input['fullnametb'] . "',
emp_id='" . $input['employeeidtb'] . "' ,
emp_mail='" . $input['emailtb'] . "',
member_type='" . $input['selectmembertypedd'] . "',
member_location='" . $input['selectmemberlocationdd'] . "',
request_type='" . $input['selectrequesttypedd'] . "',
asset_type='" . $input['selectassettypedd'] . "',
asset_number='" . $input['assetnumbertb'] . "',
serial_number='" . $input['serialnumbertb'] . "',
asset_model_number='" . $input['selectassetmodelnumberdd'] . "',
remarks_comments='" . $input['remarkstb'] . "',
timestamp= default,
status='" . $input['status'] . "' WHERE id='" . $input['id'] . "'");
} else if ($input['action'] === 'delete') {
$mysqli->query("UPDATE hamtracker SET is_flagged=1 WHERE id='" . $input['id'] . "'");
} else if ($input['action'] === 'restore') {
$mysqli->query("UPDATE hamtracker SET is_flagged=0 WHERE id='" . $input['id'] . "'");
}
mysqli_close($mysqli);
echo json_encode($input);
}
?>
你说的是echo json_encode(数组('mysqli'=>'无法连接到MySQL:'。mysqli_connect_error());什么是INPUT_POST?它可能在一个SQL语句中。我经常做的是对创建的语句进行var_转储,并在工作台中执行它,以验证是否发生任何错误。更新hamtracker SET票证\u编号。。。是一个很好的候选人。您发布的代码不会显示任何错误。请在PHP