複数のテーブルからユーザー情報を取得する必要がありますが、たとえば c.comp_title のように何かが欠落している場合、クエリは false を返します。見つかったデータを返すにはどうすればよいですか?
function one_edu($end_user, $one_id)
{
$query_str = "SELECT *
FROM edu a
JOIN user_profiles b ON a.user_id=b.user_id
JOIN (SELECT c.user_id, GROUP_CONCAT(c.comp_title) as comp_title, GROUP_CONCAT(c.comp) as comp
FROM comp c
GROUP BY c.user_id) c ON a.user_id = c.user_id
JOIN (SELECT s.user_id, GROUP_CONCAT(s.skill_title) as skill_title, GROUP_CONCAT(s.skill) as skill
FROM skills s
GROUP BY s.user_id) d ON a.user_id = d.user_id
JOIN (SELECT t.user_id, GROUP_CONCAT(t.exp_title) as exp_title, GROUP_CONCAT(t.experience) as experience
FROM exp t
GROUP BY t.user_id) e ON a.user_id = e.user_id
JOIN (SELECT e.user_id, GROUP_CONCAT(e.edu_title) as edu_title, GROUP_CONCAT(e.education) as education
FROM edu e
GROUP BY e.user_id) f ON a.user_id = f.user_id
WHERE a.user_id = ?";
$query = $this->db->query($query_str, $end_user);
if($query->num_rows() > 0)
{
foreach($query->result_array() as $stuff) {
$data[] = $stuff;
}
return $data;
}else{
return false;
}
}//end one_edu