1
Guys, I need some help, I’m filling a table with a result of a 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 boot of Troca
, And at the time you hit that button, I wanted to make a trade with another result of a Select SQL
. How can I do that? I tried several ways without any results.
Already tried using Datatables?
– Renatto Machado
I don’t understand what you really want. Could you try explaining it better please.
– Kayo Bruno
It seems that his query returns a registered teacher, and this button would be in charge of bringing some other teacher (random, I believe) from the bank, basically replace the current teacher by another.
– Eduardo Silva
Hello Paul, From what I understood of what you put you want to implement the teacher exchange function, there has to be thought, when click in return what has to happen, open a menu to choose another teacher and click OK, remove the teacher, open another page, you need to know what you want to do, once set it becomes easy to know what needs to be done if you need new queries, new scripts and so on.
– ooredroxoo
Sorry for the delay, thanks for the answers... so that’s really what I wanted to do Eduardo Silva and ooredroxxo, I wanted to use a modal to bring new teachers, but I ended up using a 'gabiarra' as soon as I click the change teacher button my div changes to an input with autocomplete where I choose a new teacher
– Paulo Vagner
I did it using Java :))
– Paulo Vagner