I have this callback
public function status()
{
$status = $this->input->post('status');
if ($status === "Confirmado")
{
$status = $this->input->post('status');
$dTimeIni = new DateTime($this->input->post('data_hora_ini'));
$dTimeFim = new DateTime($this->input->post('data_hora_fim'));
$id_consultorio = $this->input->post('id_consultorio');
$id_profissional = $this->input->post('id_profissional');
$this->load->model('agenda/consultas_model');
$result = $this->consultas_model->confirmar($id_consultorio, $id_profissional, $status, $dTimeIni, $dTimeFim);
if ($result == false)
{
return true;
}
else if ($result == true)
{
$this->form_validation->set_message('status', 'Consultorio ou Medico não disponiveis para esse horario');
return false;
}
}
if ($status === "Cancelado")
{
$id_agenda = $this->input->post('id_agenda');
$this->load->model('agenda/consultas_model');
$result = $this->consultas_model->cancelar_consultas($id_agenda);
if ($result == true)
{
return true;
}
else if ($result == false)
{
$this->form_validation->set_message('status', 'Não foi possivel cancelar essa consulta');
return false;
}
}
}
when the condition Cancelado is activated calls this function in the model
function cancelar_consultas($id_agenda)
{
$this->db->set('status', 'Cancelado');
$this->db->where('id_agenda =',$id_agenda);
$this->db->or_where('id_rel =',$id_agenda);
$this->db->update('agd_consultas');
$num=$this->db->affected_rows();
if ($num > 0 )
{
return true;
}
else
{
return false;
}
}
when update a grocery returns me a true and then a falseI don't know why this is happening I need help
