diff --git a/consultar_horario.php b/consultar_horario.php index e4e30ec..5da5739 100644 --- a/consultar_horario.php +++ b/consultar_horario.php @@ -43,12 +43,13 @@ $write = $user->admin || in_array($user->acceso, ['w']); $user->facultad['facultad_id'], ":per" => $user->periodo], single: false); // repliaction of the query in the database with database class - $nivel = $db->where('id', $user->periodo)->getOne('fs_periodo'); - $carreras = $db + $nivel = $user->periodo ? $db->where('id', $user->periodo)->getOne('fs_periodo') : false; + + $carreras = $nivel ? $db ->orderBy('carrera') ->where('facultad', $nivel['facultad_id']) ->where('nivel', $nivel['nivel_id']) - ->get('fs_carrera', 100, 'id, carrera'); + ->get('fs_carrera', 100, 'id, carrera') : []; ?>