【发布时间】:2023-03-03 03:34:01
【问题描述】:
- rule_of_exam 表 字段为 id_rule、title_exam、id_class、id_subject、date_posting、id_teacher、info、status、time
- score_multichoice 表 字段为id_score, id_rule, true, false, empty, score, id_student
- score_essay 表 字段为 id_scoressay、id_rule、id_student、score_essay
我通过查询加入了他们
"Select *
from rule_of_exam
INNER JOIN score_multichoice ON rule_of_exam.id_rule = score_multichoice.id_rule
WHERE id_student='$id_student'"
当我加入 2 个表时它可以工作,但是当我加入 3 个表时它不起作用。
"Select * from rule_of_exam
INNER JOIN score_multichoice ON rule_of_exam.id_rule = score_multichoice.id_rule
INNER JOIN score_essay ON rule_of_exam.id_rule = score_essay.id_rule
WHERE id_student='$id_student'"
$id_student 来自会话学生。
我期待输出
title_exam | score_essay | score
但它显示
警告:为 foreach() 提供的参数无效
【问题讨论】:
-
你在结果中得到了什么(尝试 var_dump($result) in php
标签: php mysql inner-join