【发布时间】:2017-12-05 06:21:31
【问题描述】:
我打算用 ajax 和 php 开发网页。但我的 get_data_in_table 函数有问题。它将以表结构显示数据。但是当我运行此代码时它显示错误。其他人工作正常。它在while循环中显示错误。但我找不到任何问题。
class get_data()
{
public function get_data_in_table($query){
$output='';
$result= $this->Getdata($query);
$output.='
<table class="table table-bordered table-striped">
<tr>
<th>Countty</th>
<th>Airline Name</th>
<th>Arrival Time</th>
<th>Status</th>
<th>Comment</th>
</tr>';
while($row= mysqli_fetch_array($result)){
$output .='
<tr>
<td>'.$row->country.'</td>
<td>'.$row->air_line.'</td>
<td>'.$row->arrival_time.'</td>
<td>'.$row->status.'</td>
<td>'.$row->comment.'</td>
</tr>';
}
$output.='</table>';
return $output;
}
?>
【问题讨论】:
-
okaaay,它显示什么错误?
-
您分享的代码没有任何
?> -
请同时提供您的 ajax 代码。您能否突出显示第 行号。 56
-
类的右大括号不在您共享的代码中。您关闭了函数体,但类体仍处于打开状态。
-
类中缺少右括号