已解决:感谢大家的快速解答
我有 3 个表,我加入了它们(在 SQL 中检查并且值是正确的)但问题是它们中的 2 个具有不同值的相同字段“denumire”,我需要回显它们
为了更清楚,这段代码回显了相同的值,但在 mysql 中,ID 是正确的:
echo "<td valign='top'>" . nl2br( $row1[`specializare`.'denumire']) . "</td>";
echo "<td valign='top'>" . nl2br( $row1[`disciplina`.'denumire']) . "</td>";
mysql表结构:
specializare->ID_specializare, denumire
disciplina->ID_disciplina,denumire
preda->ID_specializare, ID_disciplina, etc
php 中的 sql_query:
$sql1 = mysql_query("SELECT preda.ID_material, prof.ID_prof, prof.nume, prof.prenume, `specializare`.denumire, disciplina.denumire, preda.an_studiu, preda.semestru, preda.material
FROM `prof`
LEFT JOIN `preda` ON `prof`.ID_prof = `preda`.ID_prof
LEFT JOIN `specializare` ON `specializare`.ID_specializare= `preda`.ID_specializare
LEFT JOIN `disciplina` ON `disciplina`.ID_disciplina = `preda`.ID_disciplina
WHERE '".$_SESSION['ID_prof']."'=prof.ID_prof
ORDER BY specializare.denumire;");