所以我必须显示从我的数据库中获取的表中的行。我有一个JQuery来获取代码,但它显示错误
解析错误:语法错误,意外';'在第49行的C:\ xampp \ htdocs \ hopeplace \ madmin \ action.php
<?php
//action.php
if(isset($_POST["action"]))
{
include('../connect.php');
if($_POST["action"] == 'fetch')
{
$output='';
$query ="SELECT * FROM user_details WHERE user_type ='user' ORDER BY user_name ASC";
$statement = $Conndb-> prepare($query);
$statement->execute()
$result = $statement->fetchAll();//line 14
$output .= '
<table class="table table-hover">
<tr>
<td>Full Name</td>
<td>Email</td>
<td>Status</td>
<td>Action</td>
</tr>
';
foreach($result as $row){
$status ='';
if($row["user_status"] == 'Active'){
$status = '<span class="label label-success">Active</span>';
}
else{
$status = '<span class="label label-danger">Inactive</span>';
}
$output .= '
<tr>
<td>'.$row["user_name"].'</td>
<td>'.$row["user_email"].'</td>
<td>'.$status.'</td>
<td><button type="button" name ="action" class="btn btn-info btn-xs action" data-user_id="'.$row["user_id"].'" data-user_status="'.$row["user_status"].'">Action</button></td>
</tr>
';
}
$output .= '</table'>;//line 49
echo $output;
}
}
?>
即使我将代码更改为
$output .= '</table>';//line 49
它告诉我另一个错误
致命错误:未捕获错误:调用未定义的方法 mysqli_stmt :: fetchAll()in C:\ xampp \ htdocs \ hopeplace \ madmin \ action.php:14堆栈跟踪:#0 {main} 在第14行的C:\ xampp \ htdocs \ hopeplace \ madmin \ action.php中抛出