I'm trying to compare the dates coming from an array of the database so I can organize them within a timeline. The problem is that I can not compare dates to know where to put each entry ...
Maybe the problem is that within the array the dates are in date format, but if so, how to compare?
Follow the code:
<tbody>
<tr>
<td><center>Manhã</center></td>
<?php
foreach($periodo as $data){
while ($arrayBancas = mysql_fetch_array($oBanca->retorno())){
if ($arrayBancas['data'] == $data->format("Y-m-d")){
echo '<td>teste</td>';
}
}
}
?>
</tr>
Variable content:
(Period)
if(!isset($_SESSION)) {session_start();}
$idSemestre = $_SESSION['SemestreGeral'];
$oSemestre = new semestresclass();
$oSemestre -> listarEdicao($idSemestre);
$array = mysql_fetch_array($oSemestre->retorno());
$start_date = $array['DataDeInicio'];
$end_date = $array['DataDeTermino'];
$inicio = new DateTime($start_date);
$fim = new DateTime($end_date);
$fim->modify('+1 day');
$interval = new DateInterval('P1D');
$periodo = new DatePeriod($inicio, $interval ,$fim);
(Banking Array)
if(!isset($_SESSION)) {session_start();}
$idSemestre = $_SESSION['SemestreGeral'];
$oBanca = new bancasclass();
$oBanca -> listar ($idSemestre);
$arrayBancas = mysql_fetch_array($oBanca->retorno())
Here is the value of var_export of the variables:
arrayBancas: Null, 2 => NULL, 'time' => NULL, 3 = 'NULL', 'NULL', 'NULL', ' & quot; '316', 'room' = > '316',)
Date: DateTime :: __ set_state (array ('date' => '2014-06-10 00:00:00', 'timezone_type' => 3, 'timezone' => 'GMT',))