简体   繁体   English

我想显示当前时间不在(column)start_time和end_time(column)之间的所有人员记录

[英]I want to display all personnel records that the current time is not between to the (column)start_time and end_time(column)

I want to display all personnel records that the current time is not between to the (column)start_time and end_time(column) but if the current time is between to the (column)start_time and end_time(column) then dont display the personnel name. 我想显示所有人员记录,即当前时间不在(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//    

here's my query code: 这是我的查询代码:

$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);      

so I dont want to display the personnel if the current time is between '17:00:00' and '17:35:00' but when the current time is bellow 16:59;00 or 17:36:00 above then the personnel name display on my select option 因此,如果当前时间在“ 17:00:00”和“ 17:35:00”之间,但我不想显示人员,但是当当前时间在以下时间16:56; 00或17:36:00时,人员名称显示在我的选择选项上

here's my select option code: 这是我的选择选项代码:

<select>     
<?php while ($rows=mysqli_fetch_array($qryres)) { ?>     
<option><?php echo $rows['Per_fname']; ?></option>     
<?php } ?>     
</select>     

Thanks in advance 提前致谢

It could be multiple things: 可能有很多事情:

  1. You're formatting the time with a lower h : date("h:i:s"); 您正在使用较低的h格式化时间: date("h:i:s"); . This will return the 12-hour format and not the 24-hour format, So this should be: date("H:i:s"); 这将返回12小时格式,而不是24小时格式,因此应为: date("H:i:s"); . See: PHP: date - Manual for more information. 请参阅: PHP:日期-手册以获取更多信息。
  2. If you're using the DATETIME instead of TIME type in your MYSQL table structure for the schedule start and end columns you'll have to include the day, month and year in your $time variable. 如果在MYSQL表结构中使用DATETIME而不是TIME类型作为计划开始和结束列,则必须在$time变量中包括日,月和年。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我想要`start_time` 和`end_time` 计数如何得到这个? - I want to `start_time` and `end_time` count how can get this? 如何在yii2中使用start_time和end_time获取MySql中已有的记录? - How to fetch already existing records in MySql with start_time and end_time in yii2? sql使用start_time和end_time进行复杂数据排序 - sql Complex data sorting with start_time and end_time Laravel 5.1获取start_time和end_time之间的行(两个不同的字段) - Laravel 5.1 Fetch Rows between start_time and end_time (two different fields) 7个SQL行中的第一个开始时间和最后一个结束时间,仅显示1个SQL结果 - First start_time and last end_time from 7 SQL rows to show only 1 SQL result PayPal + PHP - 获取收款(开始时间/结束时间) - PayPal + PHP - Fetch incoming payments (start_time / end_time) 使用 PHP 从具有 start_time 和 end_time 的多维数组中查找总小时数? - Find total hours from multi-dimensional array with start_time and end_time using PHP? 获取每个日期 PHP 的 start_time 和 end_time 的总小时数? - Get total hours from start_time and end_time for each date PHP? 如果在范围内找到,如何找到 start_time 和 end_time 范围,然后检查 start_date 和 end_date - How to find the start_time and end_time range if found in the range then check start_date and end_date 如何管理开始时间和结束时间之间的当前时间 - How to manage current time exist between start time and end time
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM