I need put a filter in add page. Follow:
public function MySQL($query){
$this->query = mysql_query($query) or die(mysql_error());
return $this->query;
}
public function MyNum(){
return mysql_num_rows($this->query);
}
public function MyArray(){
return mysql_fetch_array($this->query);
}
public function antes($DataAntes){
$this->MySQL("SELECT * FROM `reservas` WHERE hora_inicio < '$DataAntes' AND hora_fim > '$DataAntes'");
return $this->MyNum();
}
public function depois($DataDepois){
$this->MySQL("SELECT * FROM `reservas` WHERE hora_fim > '$DataDepois' AND hora_fim > '$DataDepois'");
return $this->MyNum();
$DataFilt = new Filtro();
$DataFilt->MySQL("SELECT * FROM `reservas` hora_inicio = '$DataInicio'");
$totalRows = $DataFilt->MyNum();
$RS_Data = $DataFilt->MyArray();
if($RS_Data['hora_fim'] < $DataTermino){
//echo 'Ocupado <br /><br />';
}else{
//echo 'Livre <br /><br />';
}
if($DataFilt->antes($DataInicio)=='1'){
$RS_Data = $DataFilt->MyArray();
if($RS_Data['hora_fim']){
}
}
if(($DataFilt->antes($DataInicio)=='1') OR ($DataFilt->depois($DataTermino)=='1')){
echo 'Antes'.$DataFilt->antes($DataInicio).'<br />';
echo 'Depois'.$DataFilt->depois($DataTermino);
}
//echo $totalRows;
echo '<br />';
if($totalRows > 0){
//echo 'Ocupado de '.$RS_Data['data_inicio'].' até '.$RS_Data['data_termino'].'<br />';
}else{
//echo 'Data Livre<br />';
}
echo '<br /><br />';
}
how add script?