Good afternoon guys, I'm having a hard time here. I have two tables, cursos
and alunos_inscritos
. The student table has an id (auto_increment), which records the course code with each entry. I would like to generate a presence list in sort order, 1,2,3 and so on, which instead of bringing the ID of the table, brings the position of the array. I do not know if i was clear. See my code.
$dados = connection::select("select * from alunos where id_curso=5")
foreach ($dados as $reg) {
$ordem = array($reg['id'],$ordem)
$tabela .= '<table width:100%;">
<tr>
<td>' . $ordem . '</td>
<td>' . $reg['nome'] . '</td>
</tr>
</table>';
}