duanpi7107 2015-01-21 12:42
浏览 11

如何防止接受来自数据库的两个时间(h:i)值之间的值

if(($eventtime3 > $eventtime1) && ($eventtime3 < $eventtime2))
    {
    $errors = '<p style="color:red">Sorry, the date <b>'.$date.'</b> and time <b>'.$timein.'</b> is between a time that is already reserved. Thanks.</p>';
    }

sorry beginner here in this site. im trying to put a restriction in a time input from a reservation module in my website

as you can see in the image below my reservation module is accepting the time input even if it is in between the time in and time out values

here's an image to further explain it here's an image to further explain it

i tried to convert the string value of time from my database to this

$eventDate1 = DateTime::createFromFormat("h:i", "$tin");
$eventDate2 = DateTime::createFromFormat("h:i", "$tout");
$eventDate3 = DateTime::createFromFormat("h:i", "$timein");
$eventDate4 = DateTime::createFromFormat("h:i", "$timeout");

but still can't do the restrictions so how to put restriction in my inputs for it to prevent accepting values in between two time values

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 对于squad数据集的基于bert模型的微调
    • ¥15 为什么我运行这个网络会出现以下报错?CRNN神经网络
    • ¥20 steam下载游戏占用内存
    • ¥15 CST保存项目时失败
    • ¥15 树莓派5怎么用camera module 3啊
    • ¥20 java在应用程序里获取不到扬声器设备
    • ¥15 echarts动画效果的问题,请帮我添加一个动画。不要机器人回答。
    • ¥15 Attention is all you need 的代码运行
    • ¥15 一个服务器已经有一个系统了如果用usb再装一个系统,原来的系统会被覆盖掉吗
    • ¥15 使用esm_msa1_t12_100M_UR50S蛋白质语言模型进行零样本预测时,终端显示出了sequence handled的进度条,但是并不出结果就自动终止回到命令提示行了是怎么回事: