<?php? ? if(mysqli_num_rows($result)>0)? ? {?>? ? ? ? <table class="table table-striped" id="example" align="center">? ? ? ? ? ? <tr>? ? ? ? ? ? ? ? <thead>? ? ? ? ? ? ? ? ? ? <th style="padding:7px">Name</th>? ? ? ? ? ? ? ? ? ? <th style="padding:7px">Email</th>? ? ? ? ? ? ? ? ? ? <th style="padding:7px">Position</th>? ? ? ? ? ? ? ? ? ? <th style="padding:7px">Action</th>? ? ? ? ? ? ? ? </thead>? ? ? ? ? ? </tr>? ? ? ? ? ? ? ? <tbody id="myTable">? ? <?php? ? ? ? echo "<tr>";? ? ? ??? ? ? ? while($row=mysqli_fetch_assoc($result))? ? ? ? {? ? ? ? ? ? $id = $row['id'];? ? ? ? ? ? echo "<td style='padding:7px'>".$row["name"]."</td>";? ? ? ? ? ? echo "<td style='padding:7px'>".$row["email"]."</td>";? ? ? ? ? ? echo "<td style='padding:7px'>".$row["position"]."</td>";? ? ? ? ? ? ?>? ? ? ? ? ? <td style='padding:7px'><button class="btn btn-info"? onclick="deleteUser('<?php echo $row['id'];?>')"> <i class="fa fa-trash"></i> DELETE </button> |? ? ? ? ? ? <a class="btn btn-info" href="edit_user.php?id=<?php echo $row['id'];?>"> <i class="fa fa-pencil"></i> EDIT</a> |? ? ? ?? ? ? ? ? ? <button class="btn btn-info? abc" value="View Data" data-id="<?php echo $row['id']; ?>">? <i class="fa fa-eye"></i> VIEW DATA </button>? ??? ? ? ? ? ? </td>? ??? ??? ? ? ? ? ? <?php echo "</tr>";?? ? ? ? } ?>? ? ? ? ? ? ? ? </tbody>? ??? ? ? ? ? ? ? ? <tfoot>? ? ? ? ? ? ? ? <th style="padding:7px">Name</th>? ? ? ? ? ? ? ? <th style="padding:7px">Email</th>? ? ? ? ? ? ? ? <th style="padding:7px">Position</th>? ? ? ? ? ? ? ? <th style="padding:7px">Action</th>? ? ? ? ? ? ? ? </tfoot>? ? ? ? ? ? ? ??? ? ? ? <?php? ? ? ? ?echo "</table>";? ? ? ? ?? ? ?}? ? else? ? ? ? {? ? ? ? ? ? echo "No row exists";? ? ? ? }? ? ?>我正在使用 Jquery Datatable 來排序、搜索和分頁數據。在我運行代碼后,它顯示錯誤 _DT_CellIndex' 未定義。?<tr>、<td>、<th>、<thead>、<tbody>、<tfoot>標簽正確使用并正確關閉。
1 回答

紅顏莎娜
TA貢獻1842條經驗 獲得超13個贊
首先,我在谷歌上搜索了您的錯誤,看起來這通常意味著您的表在某種程度上存在格式錯誤,例如行大小不匹配。
它說“錯誤:您不能在 thead 組之前定義任何行”
我很確定你的問題是你需要嵌套tr
在 的內部thead
,而不是相反:
? ? ? ? <table class="table table-striped" id="example" align="center">
? ? ? ? ? ? <thead>
? ? ? ? ? ? ? ? <tr>
? ? ? ? ? ? ? ? ? ? <th style="padding:7px">Name</th>
? ? ? ? ? ? ? ? ? ? <th style="padding:7px">Email</th>
? ? ? ? ? ? ? ? ? ? <th style="padding:7px">Position</th>
? ? ? ? ? ? ? ? ? ? <th style="padding:7px">Action</th>
? ? ? ? ? ? ? ? </tr>
? ? ? ? ? ? </thead>
- 1 回答
- 0 關注
- 148 瀏覽
添加回答
舉報
0/150
提交
取消