Well, I'm in need of help, I'm filling a table with a result of Select SQL
. As the code below shows:
$sql = "SELECT Nome, COUNT(Especialidades_idEspecialidades)
FROM especialidades_has_professores AS ehp,
professores AS p,
professores_has_universidade AS phu,
universidades AS u
WHERE ehp.Professores_idProfessores = p.idProfessores
AND phu.Professores_idProfessores = p.idProfessores
AND phu.Universidades_idUniversidades = u.idUniversidades
AND u.DistanciaAtual < '$raio'
AND p.nome != '$orientador'
AND ehp.Especialidades_idEspecialidades IN (
SELECT Especialidades_idEspecialidades
FROM especialidades_has_temas AS eht
WHERE eht.Temas_idTemas = '$idTemas'
)
GROUP BY ehp.Professores_idProfessores
ORDER BY COUNT(Especialidades_idEspecialidades) DESC
LIMIT $numero ";
foreach ($pdo->query($sql) as $row ) {
echo '<tr>';
echo '<td><span class="glyphicon glyphicon-user"></span></td>';
echo '<td>'. $row['Nome'] . '</td>';
echo '<td>';
echo '<a class="btn btn-app">';
echo ' <i class="fa fa-repeat"></i> Trocar Professor';
echo '</a>';
echo '</td>';
echo '<td>';
echo '<a class="btn btn-app">';
echo '<span class="badge bg-aqua">Email Enviado</span>';
echo '<i class="fa fa-envelope"></i> Enviar';
echo '</a>';
echo '</td>';
echo '</tr>';
}
?>
In the table there is a Troca
button, and at the time that button is triggered, I wanted to make an exchange with another result of a Select SQL
. How can I do this? I tried several shapes with no results.