我想显示所有人员记录,即当前时间不在(column)start_time和end_time(column)之间,但是如果当前时间在(column)start_time和end_time(column)之间,则不要显示人员名称。
Sched_time_start = '17:00:00';
Sched_time_end = '17:35:00';
$time=date("h:i:s");//this is my current time variable//
这是我的查询代码:
$qry= "SELECT * from personel as A Left join sched as B on A.Per_ID = B.Sched_Per_ID where '$time' NOT BETWEEN B.Sched_time_start AND B.Sched_time_end";
$qryres = mysqli_query($connect, $qry);
所以如果当前时间在'17:00:00'和'17:35:00'之间,但是当当前时间在16:59; 00或17:36:00以下时,我不想显示人员在上方,然后在我的选择选项上显示人员姓名
这是我的选择选项代码:
<select>
<?php while ($rows=mysqli_fetch_array($qryres)) { ?>
<option><?php echo $rows['Per_fname']; ?></option>
<?php } ?>
</select>
预先感谢
答案 0 :(得分:0)
可能有很多事情:
h
:date("h:i:s");
格式化时间。这将返回12小时格式而不是24小时格式,因此应为:date("H:i:s");
。有关更多信息,请参见:PHP: date - Manual。DATETIME
而不是TIME
,则必须在{{ 1}}变量。