Created
February 18, 2015 09:28
-
-
Save rdobrynin/9e5543c3e742d3db7717 to your computer and use it in GitHub Desktop.
CI Active records JOIN two tables
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <? | |
| public function getProjectUsers($pid) { | |
| $data = array(); | |
| $query = $this->db->select('*') | |
| ->from('projects') | |
| ->join('users', 'projects.uid = users.id') | |
| ->where('projects.assign', 0) | |
| ->where('projects.pid', $pid) | |
| ->get(); | |
| if ($query->num_rows() > 0) | |
| { | |
| foreach ($query->result() as $row) { | |
| $data[] = $row; | |
| } | |
| } | |
| else { | |
| $data = false; | |
| } | |
| $query->free_result(); | |
| return $data; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment