【发布时间】:2012-04-19 10:03:13
【问题描述】:
我有 2 个表
student_job_log->id,job_id,student_id,created_dt
student_info->id,user_id,first_name,last_name
我已经在模型(studentJobLog)中建立了关系
public function relations()
{
// NOTE: you may need to adjust the relation name and the related
// class name for the relations automatically generated below.
return array(
'student_info'=>array(self::BELONGS_TO,'StudentInfo','id','joinType'=>'LEFT JOIN',
'select'=>'first_name, last_name')),
);
}
我得到了这个错误 问题是什么。 我的关系出了点问题,我不知道 :(
我想要学生信息中的名字和姓氏,请帮助我...:(
【问题讨论】:
-
你好@jon 请给我查询(关系)...我想要来自 student_info 表的 first_name 和 last_name 以及来自 student_job_log 的 created_dt
-
我做不到。如果您有一个有充分记录的具体问题,我可以提供帮助。
-
在我这样写的视图文件中 echo $data->student_info;exit;nothing iscoming output
-
抱歉,这还远远不够。
-
你提到你收到了一个错误,但你没有说它是什么错误。此外,如果您有
echo $data->student_info;exit;,则student_info中可能没有内容,因此什么也不显示。您向我们展示了部分代码,而不是告诉我们问题所在。如果没有更多信息,没有人可以帮助您。