0
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 for each registration. I would like to generate a presence list in the type order, 1,2,3 and so on, which instead of bringing the table ID, brings the position of the array. I don’t know if I was clear. Look at 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>';
}
foreach ($dados as $reg as $key) {
$key
is the current input of the array.– rray
Didn’t work :/
– Eduardo Santos
is that this code would be foreach ($given as $key => $reg) hence the $key is the key, but could use tbm array_keys();
– Fleuquer Lima
I got it right guys. Thanks.
– Eduardo Santos
How to start the $key in the second position, not to show the zero.
– Eduardo Santos