Estou criando um módulo de diário on line, preciso obter alunos com 3 faltas consecutivas, segue o select de entrada, quando o aluno tem mais de 2 horas de aula, o select exibe diferente.
<select name="d_status[<?=$i?>]" size="1">
<? if ($thora > 2 ) { ?>
<option value="3" <?php if ( $d_status == 3 ) echo 'selected="selected"'; ?>>Presença+Presença</option>
<option value="4" <?php if ( $d_status == 4 ) echo 'selected="selected"'; ?>>Presença+Falta</option>
<option value="5" <?php if ( $d_status == 5 ) echo 'selected="selected"'; ?>>Falta+Presença</option>
<option value="6" <?php if ( $d_status == 6 ) echo 'selected="selected"'; ?>>Falta+Falta</option>
<? } else { ?>
<option value="1" <?php if ( $d_status == 1 ) echo 'selected="selected"'; ?>>Presença</option>
<option value="2" <?php if ( $d_status == 2 ) echo 'selected="selected"'; ?>>Falta</option>
<? } ?>
</select>
A soma total eu tenho:
$sql_1 = mysql_num_rows(mysql_query("SELECT * FROM ****** WHERE
`d_matricula` = '" . $res_['matricula'] .
"' AND `d_ano_semestre` = '" . $sem .
"' AND `d_filial` = '" . $filial .
"' AND `d_curso` = '" . $curso .
"' AND `d_dias` = '" . $dias .
"' AND `d_horario` = '" . $horario .
"' AND d_status = '2' AND MONTH(d_data) = '" . $mes .
"' AND YEAR(d_data)= '".$ano."'"));