【问题标题】:Appointment fixing预约固定
【发布时间】:2015-11-03 10:51:25
【问题描述】:

我想根据给定日期和 php mysql 中的治疗师 ID 从两个不同的列 (start_time,end_time) 中选择两个给定时间(start_time,end_time) 之间的数据。

我的数据库如下所示

appointment_id name    age email                appointment_date appointment_time appointment_endtime user_id therapist_id status
             4 testing  25 notjitendra@mail.com       2015-11-03         01:00:00            02:00:00       2           12 SEND
             3 testing  25 notjitendra@mail.com       2015-11-03         01:00:00            02:00:00       2           12 SEND
             2 testing  25 notjitendra@mail.com       2015-11-03         01:00:00            02:00:00       2           12 SEND
             1 testing  25 notjitendra@mail.com       2015-11-03         05:00:00            06:00:00       2           12 SEND

我正在尝试编写类似的查询

"SELECT therapist_id, appointment_time, appointment_endtime 
 FROM appointment
 WHERE ((appointment_time BETWEEN '".$timee."' AND '".$end_time."' ) OR     
 (appointment_endtime BETWEEN '".$end_time."' AND '".$timee."') ) AND          
 therapist_id='".$_REQUEST['therapist_id']."' AND       
 appointment_date='".$_REQUEST['date']."'" 

【问题讨论】:

  • “给我正确的解决方案” => 拜托?
  • "给我正确的解决方案" => 有人可以帮我走上正轨吗?
  • 1.我可以阅读那些电子邮件地址。因此,如果他们真的很敏感,请考虑从您上传的任何位置删除该图像。 2. 见归一化。将客户信息存储在此表中显然是多余的。 3. 你并没有真正存储“年龄”,是吗? 4. 考虑将日期和时间存储为单个实体。效率更高。

标签: php mysql sql appointment


【解决方案1】:

试试这个:

"SELECT therapist_id,appointment_time,appointment_endtime FROM appointment     WHERE appointment_time>='$timee' and appointment_endtime<='$end_time' 
AND therapist_id='".$_REQUEST['therapist_id']."' AND appointment_date='".$_REQUEST['date']."'"

【讨论】:

  • 我很想在'; DELETE FROM appointment; -- 安排约会。你认为那个日期还有吗?
  • ANSWER SELECT treatment_id,appointment_time,appointment_endtime FROM 约会 WHERE ((appointment_time BETWEEN '".$timee."' AND '".$end_time."' ) OR (appointment_endtime BETWEEN '".$timee. "' AND '".$end_time."') ) AND treatment_id='".$_REQUEST['treatment_id']."' ANDointment_date='".$_REQUEST['date']."'
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-09-27
  • 2021-07-13
  • 1970-01-01
  • 2015-08-11
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多