database - how to pass variable from controller to model in PHP MVC -


i have been trying pass variables model through controller function variable can used in corresponding query database.here code

public function choosegroup() {     $data['area']=$_get['area']; //variable view source;this loaded in function, have printed echo sure.     $this->load->model('information_model',$data);     $groupdata['rows']= $this->information_model->getgroupdetails();   // var_dump($groupdata); } 

model code:

function getgroupdeatils() {             $this->db->select('area'); //area suppose contain value              $q = $this->db->get('group'); //group table name             if ($q->num_rows() > 0)                 foreach ($q->result() $rows) {                     $data[] = $rows;                 }             return $data;         }       

the value $data['area'] some reason isnt being recognized information_model , query not processed.where did go wrong?:( please help!

in controller call model should below

public function choosegroup() {     $data['area']=$_get['area'];      $this->load->model('information_model');     $groupdata['rows']= $this->information_model->getgroupdetails($data); } 

and in model declare method below

function getgroupdetail($data) {     // query code here } 

Comments

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -