我想将列名日期更改为Day,我将其更改为这样,但在显示数据时,我将它更改为Day的方式是错误的。
<tr>
<td width="" class="rounded" scope="col"><?php echo $row['date as day']; ?></td>
</tr>
这是正常的代码
</tr>
<tr>
<td width="" class="rounded" scope="col"><?php echo $row['date']; ?></td>
</tr>
我想你是指一周中的某一天。您可以使用日期功能。
如果你的日期是一个日期/时间,而不是时间戳,你会先使用strtotime()使其成为时间戳。
<?php echo date("D", strtotime($row['date'])); ?>
如果是周三,将在周三输出
<?php echo date("l", strtotime($row['date'])); ?>
如果是星期三,将在星期三输出。这是小写,L不是数字1。
查询:
SELECT date as day FROM table;
然后:
<tr>
<td width="" class="rounded" scope="col"><?php echo $row["day"]; ?></td>
</tr>
HTH。