【发布时间】:2020-11-28 08:37:54
【问题描述】:
如何使用新表显示基于任务结束日期的数据。这意味着,完整的
**Staff 1**
**Staff 2**
在期待中感谢。
<div>
<table class="table table-bordered">
<tr>
<th>ID</th>
<th>Task Name</th>
<th>Remarks</th>
<th>Start Date</th>
<th>End Date</th>
</tr>
<?php
$sql = "SELECT * FROM dl_fullremarks ";
$result = mysqli_query($conn, $sql);
foreach ($result as $row) {?>
<tr>
<td><?php echo $row['staff_id']; ?></td>
<td><?php echo $row['task_name']; ?></td>
<td><?php echo $row['task_remarks']; ?></td>
<td><?php echo $row['task_startdate']; ?></td>
<td><?php echo $row['task_enddate']; ?></td>
</tr>
<?php
}
?>
</table>
</div>
【问题讨论】:
-
这取决于您想在哪里进行排序,从您的查询、后端还是前端?
-
@AngeLOL 感谢您的积极回应。您附上了我可以尝试的任何方法并让您知道反馈。
-
这是更改查询的问题。其他一切都保持不变。如果您的 end_date 列的数据类型为
datetime,那么像"SELECT * FROM table_name WHERE end_date = $end_date"这样的简单查询就可以了。如果您想要某种形式的排序,那么您可以在查询末尾添加ORDER BY column_name ASC|DESC。
标签: javascript php