I do this query in PHP / MySQL and I want the records to be sorted by the nom field but it shows nothing.
$stm = $BD->prepare("SELECT a.cod, a.nom, b.id_pago, c.planilla
FROM sc_personal a,
sc_condicion b,
sc_planilla c
WHERE a.id_condicion = b.id_condicion
AND a.id_trab = c.id_trab
AND a.cod ='.$valor'. ORDER BY a.nom ASC");
Before ending in:
AND a.cod =".$valor);
And there was no problem, now I added the ORDER BY and it shows nothing. What is the problem?