Welcome Guest, Not a member yet? Register   Sign In
How to join three tables together with three where statement
#1

[eluser]itz4mesays[/eluser]
Please i have three different tables that i am trying to join together with three different where statements and the where conditions is from the second table. I tried running it without the where condition and it worked but I am getting an empty set using the where conditions. Please how do i get this right?

Model
public function print_form($id, $level, $semester)
{

$this->db->SELECT('*')->FROM('asims_student_details');
$this->db->JOIN('studcourses', 'asims_student_details.matric_number=studcourses.matric_number');
$this->db->JOIN('uploaded_passport', 'asims_student_details.matric_number=uploaded_passport.matric_number');
$this->db->WHERE('studcourses.matric_number', $id);
$this->db->WHERE('studcourses.level', $level);
$this->db->WHERE('studcourses.semester', $semester);
$query = $this->db->get();
if($query->num_rows()>0)
{
foreach ($query->result_array() as $row) {
$data['']=$row;
}
return $data;
}
//else{return FALSE;}
}
#2

[eluser]itz4mesays[/eluser]
Thanks guyz, i finally got the solution to the question...Just the field missing in one of the tables i was querying...




Theme © iAndrew 2016 - Forum software by © MyBB