Javascript 表中没有可用数据,但显示数据库中的数据
数据表显示了数据库的内容,但仍然显示一条错误消息:表中没有可用数据。 如何解决这个问题,只显示数据而不显示错误消息Javascript 表中没有可用数据,但显示数据库中的数据,javascript,php,jquery,datatables,Javascript,Php,Jquery,Datatables,数据表显示了数据库的内容,但仍然显示一条错误消息:表中没有可用数据。 如何解决这个问题,只显示数据而不显示错误消息 <table name= "displaycase" id="example1" class="table table-bordered table-striped" method = "post"> <thead> <tr> <th>Case Title</th> <th>
<table name= "displaycase" id="example1" class="table table-bordered table-striped" method = "post">
<thead>
<tr>
<th>Case Title</th>
<th>Court</th>
<th>Dockent Number</th>
<th>Nature</th>
<th>Actions Taken</th>
<th>Status</th>
<th>Due Date </th>
</tr>
</thead>
<tbody>
<tbody class = "searchable">
<?php
if (mysql_num_rows($result) > 0) {
// output data of each row
while ($row = mysql_fetch_assoc($result)) {
echo
"</td><td>" . $row["CaseTitle"] .
"</td><td>" . $row["Court"] .
"</td><td>" . $row["docketNum"] .
"</td><td>" . $row["nature"] .
"</td><td>" . $row["actionsTaken"] .
"</td> <td>" . $row["status"] .
"</td> <td>" . $row["dueDate"] .
"</td></tr>";
}
} else {
}
?>
</tbody>
案例标题
法庭
摘要号
本性
采取的行动
地位
到期日
-
$(文档).ready(函数(){
$(“#示例1”).DataTable({
“分页”:false,
“排序”:正确,
“信息”:错误,
“语言”:{
“emptyTable”:“无数据”
}
})
});
那是因为你错过了一个
tr
,而你在这里的回音中回音
while($row = mysql_fetch_assoc($result)) {
echo
"<tr><td>".$row["CaseTitle"].
"</td><td>".$row["Court"].
"</td><td>".$row["docketNum"].
"</td><td>".$row["nature"].
"</td><td>".$row["actionsTaken"].
"</td> <td>".$row["status"].
"</td> <td>".$row["dueDate"].
"</td></tr>";
}
while($row=mysql\u fetch\u assoc($result)){
回音
“.$行[“案例标题”]。
“.$row[“Court”]。
“.$row[“docketNum”]。
“.$row[“nature”]。
“.$row[“actionsTaken”]。
“.$行[“状态”]。
“.$row[“dueDate”]。
"";
}
标记中删除method=“post”
内有两个
标签。移除一个
在尚未打开时关闭
<table name= "displaycase" id="example1" class="table table-bordered table-striped">
<thead>
<tr>
<th>Case Title</th>
<th>Court</th>
<th>Dockent Number</th>
<th>Nature</th>
<th>Actions Taken</th>
<th>Status</th>
<th>Due Date </th>
</tr>
</thead>
<tbody class = "searchable">
<?php
if (mysql_num_rows($result) > 0) {
while ($row = mysql_fetch_assoc($result)) {
echo
"<tr>".
"<td>" . $row["CaseTitle"] ."</td>".
"<td>" . $row["Court"] ."</td>".
"<td>" . $row["docketNum"] ."</td>".
"<td>" . $row["nature"] ."</td>".
"<td>" . $row["actionsTaken"] ."</td>".
"<td>" . $row["status"] ."</td>".
"<td>" . $row["dueDate"] ."</td>".
"</tr>";
}
} else {
}
?>
</tbody>
</table>
案例标题
法庭
摘要号
本性
采取的行动
地位
到期日
[注意:在
表
标记中,方法
属性在做什么?!?如果只想使用datatables显示数据,那你就错了。你只需要添加html/php文件,请检查[link]+10以纠正所有可能的问题,并特别注意
<table name= "displaycase" id="example1" class="table table-bordered table-striped">
<thead>
<tr>
<th>Case Title</th>
<th>Court</th>
<th>Dockent Number</th>
<th>Nature</th>
<th>Actions Taken</th>
<th>Status</th>
<th>Due Date </th>
</tr>
</thead>
<tbody class = "searchable">
<?php
if (mysql_num_rows($result) > 0) {
while ($row = mysql_fetch_assoc($result)) {
echo
"<tr>".
"<td>" . $row["CaseTitle"] ."</td>".
"<td>" . $row["Court"] ."</td>".
"<td>" . $row["docketNum"] ."</td>".
"<td>" . $row["nature"] ."</td>".
"<td>" . $row["actionsTaken"] ."</td>".
"<td>" . $row["status"] ."</td>".
"<td>" . $row["dueDate"] ."</td>".
"</tr>";
}
} else {
}
?>
</tbody>
</table>