1
I have a table of projects and within this projects I have several students.
I made a select
in both tables to count how many students there are in each project, so I selected so :
Select inscricao.id,
inscricao.titulo,
inscricao.orientador,
inscricao.email_professor,
inscricao.escola,
inscricao.habilitacao,
inscricao.serie,
(select count(alunos.id_inscricao) as 'qtde_alunos' from alunos where alunos.id_inscricao=inscricao.id)
from inscricao order by inscricao.titulo
But I didn’t understand how to print the column that was created to count the records in PHP.
I took the column like this:
while ($registro = mysqli_fetch_array($resultado))
{
id = $registro['id'];
$titulo = utf8_decode($registro['titulo']);
$escola = utf8_decode($registro['escola']);
$habilitacao = utf8_decode($registro['habilitacao']);
$serie = $registro['serie'];
$qtde_alunos =$registro['qtde_alunos'];
}
But it does not print the value of the variable $qtde_alunos
.