function getSequencialEnturmacaoByTurmaId($matriculaId, $turmaId) { $db = new clsBanco(); $sql = 'select coalesce(max(sequencial), 1) from pmieducar.matricula_turma where ativo = 1 and ref_cod_matricula = $1 and ref_cod_turma = $2'; if ($db->execPreparedQuery($sql, array($matriculaId, $turmaId)) != false) { $db->ProximoRegistro(); $sequencial = $db->Tupla(); return $sequencial[0]; } return 1; }