Guest User

Untitled

a guest
Jul 22nd, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. public function get_all_candidates_info(){
  2.  
  3. $this->db->select('*'); // select all columns
  4. $this->db->from('candidates'); // FROM table
  5. $this->db->join('work_experiences', 'work_experiences.candidate_id = candidates.id','left'); // INNER JOIN
  6. $this->db->join('skills', 'skills.candidate_id = candidates.id','left'); // INNER JOIN
  7. $this->db->join('educations', 'educations.candidate_id = candidates.id','left'); // INNER JOIN
  8. $query = $this->db->get(); // GET RESULT
  9.  
  10. $result = $query->result_array();
  11.  
  12. //return $result;
  13.  
  14.  
  15.  
  16. $newArray = array();
  17. foreach ($result as $key => $value) {
  18. $newArray[$value['first_name']."asdasds"][] = $value; // sort as per candidate name
  19. }
  20.  
  21.  
  22. foreach ($newArray as $key => $value) {
  23. echo $key."<br/>"; // print Category Name
  24. foreach ($value as $final_value) {
  25.  
  26. echo $final_value['skill_name']."<br/>"; // print all items against category
  27. echo $final_value['education_provider']."<br/>"; // print all items against category
  28. echo $final_value['company_name']."<br/>"; // print all items against category
  29.  
  30. }
  31. }
Add Comment
Please, Sign In to add comment