I am creating a journal module on line, I need to get students with 3 consecutive absences, follow the input select, when the student has more than 2 hours of class, select displays different.
<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>
The total sum I have:
$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."'"));
The structure of the table where you save presence or false status:
- Estrutura da tabela 'jos_users_cursos_diarios'
--
CREATE TABLE 'jos_users_cursos_diarios' (
'd_matricula' varchar(8) NOT NULL,
'd_ano_semestre' varchar(4) NOT NULL,
'd_filial' varchar(50) NOT NULL,
'd_curso' varchar(6) NOT NULL,
'd_dossie' varchar(5) NOT NULL,
'd_dias' varchar(1) NOT NULL,
'd_horario' varchar(8) NOT NULL,
'd_data' date NOT NULL,
'd_status' varchar(10) NOT NULL,
'd_obs' varchar(100) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;