Skip to content

Instantly share code, notes, and snippets.

@laabroo
Created April 21, 2012 10:13
Show Gist options
  • Save laabroo/2436352 to your computer and use it in GitHub Desktop.
Save laabroo/2436352 to your computer and use it in GitHub Desktop.
Using Join Table on Code Igniter
//on model
function getUserDetails(){
$this->db->select('coment,name,dob,contry,main_photo');
$this->db->from('user');
$this->db->join('coment', 'coment.email = user.email');
$query = $this->db->get();
if ($query->num_rows() > 0) {
return $query->result();
}
else {
return null;
}
}
//on controller
function getUserDetails(){
$query = $this->mymodel->getUserDetails();
print_r($query);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment