0
I would like to add this variable interval to this code but I am not getting it , if you can help me I will be very grateful.
I found this code on the Internet and adapted it to my system, but I bumped into this issue of interval.
date_default_timezone_set("Brazil/East");
$con=@mysql_connect("localhost","root","");
$bd=mysql_select_db("test",$con);
//$hora_inicio = $_POST['hora_inicio'];
//$hora_final = $_POST['hora_final'];
$hora_inicio = "07:00";
$hora_final = "10:00";
$int ="00:30";// variavel que define o intervalo
$ini = strtotime($hora_inicio);
$fim = strtotime($hora_final);
$atu = $ini;
$i = 1;
for ($atu = $ini ; $atu <= $fim; $atu = strtotime('+30 minutes', $atu)) {
$hr_agendamento = date('H:i', $atu);
$sql = mysql_query("INSERT INTO agenda (id_agenda,hr_agendamento) VALUES('','$hr_agendamento')");
}
echo "agenda criada";
even so the edited question do not quite know what you want to insert with a time interval ?
– 13dev
needs to be clearer and more specific in what you want
– Otto
Possible duplicate of Schedule grid with PHP
– NoobSaibot
I think it’s different because I want to add the interval. but in fact it’s the same code.
– Inácio Régis