こんにちは現在、データベースに4つのテーブルがあります。tb_student、tb_history、tb_section、tb_adviserです。これまでのところ、私はこの行を使用して、特定の学生の履歴を表示しました。
$qry_display = "SELECT
a.student_id, a.section_id, a.level, a.photo, a.address, a.father_occupation, a.father_phone, a.father_company, a.mother_occupation, a.mother_phone, a.mother_company,a.gpa,
b.fname, b.sex, b.lname, b.mname, b.birth_date, b.birth_place, b.address, b.father, b.father_degree, b.mother, b.mother_degree,
c.section_name, c.adviser_id
FROM tbl_er AS a
LEFT OUTER JOIN tbl_enroll AS b ON a.student_id = b.student_id
LEFT OUTER JOIN tbl_section AS c ON a.section_id = c.section_id
WHERE a.student_id=".$id." AND a.level='1st Year'";
私の主な問題は、これらの他の情報とともにアドバイザーの名前を表示する必要があることです。だから置くことを考えていました。tb_adviserはadvisor_idを介してのみtb_sectionに接続されていることに注意してください
LEFT OUTER JOIN tbl_adviser AS d ON a.student_id = c.adviser_id
whereステートメントの前にこの行を追加しました。この行をSELECTフィールドに挿入します。
d.lname_adviser
現在は動作しません。誰もが私の問題に光を当てるでしょう。