3

I have tried many ways to join two tables but showing error. showing fatal error.i am beginner in CodeIgniter.

On Model my function is this

$quer=$this->db->select('*')->from('assign_tble')
->join('course_details','assign_tble.ccode=course_details.ccode','LEFT')
->where('assign_tble.scode',$userID);
return $quer->result(); 

while running it is showing fatal error

Fatal error: Call to undefined method CI_DB_mysqli_driver::result() in C:\wamp\www\keitauniv\application\models\AllCourses_m.php on line 41 Message: Call to undefined method CI_DB_mysqli_driver::result()

this is the error showing while running.

Vimal
  • 1,140
  • 1
  • 12
  • 26
Rashid
  • 127
  • 2
  • 3
  • 12

2 Answers2

3
$quer=$this->db
->select('*')
->from('assign_tble')
->join('course_details','assign_tble.ccode=course_details.ccode','LEFT')
->where('assign_tble.scode',$userID)

->get(); //Getting the results ready...


return $quer->result(); 

---.---

You have to get() the results before using them

You can find CI Query Builder's docs Here

El Don
  • 902
  • 7
  • 14
3
$this->db->select('*')
->from('assign_tble')
->join('course_details','assign_tble.ccode=course_details.ccode','LEFT')
->where('assign_tble.scode',$userID);

 $query = $this->db->get();         
 return $query->result();   
RïshïKêsh Kümar
  • 4,734
  • 1
  • 24
  • 36