Php 在mysql表中插入时隙

Php 在mysql表中插入时隙,php,mysql,Php,Mysql,我正在使用PHP和MySQL开发一个系统。 我的一个表单会提示用户填写两个文本框,即startTime和endTime。用户必须填写这两个文本框,提交后,将它们插入名为Slot的我的表中,并与以前的数据一起输出 5:30 6:00 6:30 7:00 7:30 8:00 我怎么做?引导我走你的答案。 这是我的密码: $i=0; $sid=1; $appointmentsdate=$_REQUEST['sTime']; $appointmentedate=$_REQUEST

我正在使用PHP和MySQL开发一个系统。 我的一个表单会提示用户填写两个文本框,即
startTime
endTime
。用户必须填写这两个文本框,提交后,将它们插入名为
Slot
的我的表中,并与以前的数据一起输出

 5:30  
 6:00
 6:30
 7:00
 7:30
 8:00
我怎么做?引导我走你的答案。 这是我的密码:

$i=0;
$sid=1;
$appointmentsdate=$_REQUEST['sTime'];   
$appointmentedate=$_REQUEST['eTime'];

for($appointmentsdate;$appointmentsdate<$appointmentedate;$appointmentsdate++)
{
    $arrayStartTime[$i]="{$appointmentsdate}:00";
    $i++;
    $arrayStartTime[$i]="{$appointmentsdate}:30";
    $i++;
}
echo "<pre>";       
print_r($arrayStartTime);
die;

for ($k=0; $k<sizeof($arrayStartTime); $k++) 
{
    SJB_DB::query('insert into `schedule_slot` (`schedule_id`,`startTime`,`endTime`) values  
            (?s,?s,?s)',$sid,$arrayStartTime[$k],$arrayStartTime[$k+1]);    
}           
$i=0;
$sid=1;
$appointmentsdate=$_请求['sTime'];
$appointmentedate=$_请求['eTime'];
对于($AppointsDate;$appointmentsdate
#您的输入
$start=“11:00”;
$time\u end=“13:30”;
#将它们转换为时间戳
$time\u start=strottime$start;
$time\u end=strottime($time\u end);
#循环

while($time\u start Warning:strotime():依赖系统的时区设置是不安全的。您需要使用date.timezone设置或date\u default\u timezone\u set()功能。如果您使用了这些方法中的任何一种,但仍收到此警告,则很可能是您拼写了时区标识符。我们暂时选择了时区“UTC”,但请设置date.timezone以选择您的时区。联机6@kapil:该错误是不言自明的。请使用
date\u default\u timezone\u set()
设置默认时区的功能。
#your inputs
$start = "11:00"; 
$time_end = "13:30";

#converting them to timestamps
$time_start = strtotime($start);
$time_end = strtotime($time_end);

#looping
while($time_start <= $time_end){
  $someArr[] = date("H:i",$time_start)."\n";
  $time_start = strtotime('+30 minutes',$time_start);
}
$i=0;
$sid=1;

$appointmentsTimeStart = strtotime($_REQUEST['sTime']);
$appointmentsTimeEnd = strtotime($_REQUEST['sTime']);

for($appointmentsTimeStart; $appointmentsTimeStart<$appointmentsTimeEnd; $appointmentsdate1++)
{    
    $arrayStartTime[$i] = date("H:i", $appointmentsTimeStart);
    $appointmentsTimeStart = strtotime('+30 minutes',$appointmentsTimeStart);    
    $i++;    
}

print_r($arrayStartTime);