php - How can I display or view multiple checkbox WHERE condition in Codeigniter -


i need help.i can't apply where condition clause in multiple selected checkbox value.like if select 'accounitng' or 'php' want here use condition where *("skill", "php")* here, skill table field name , php checkbox selected value.if select category 'php' 'php' related data show.checkbox selected value save databse ' , ' comma separated. php,java,accounting,sql

for save data used model:

public function saveinstituteoffercourse($data = array()) {         if ($this->db->insert('tbl_course_offred', $data)) {             return $this->db->insert_id();         }         return false;     } 

for controller use:

public function savecourses() {         $data = array();         $this->load->library('form_validation');         $this->form_validation->set_rules('skill', 'skill', 'required');         if ($this->form_validation->run()) {             /* @var $skill user_admin_controller */             $skill = implode(',', $this->input->post('skill'));             $data['skill'] = $skill;             $data['user_id'] = $this->session->userdata('user_id');             $this->user_admin_model->saveinstituteoffercourse($data);             redirect("user_admin_controller/useradminpanel");         }     } 

my workflow likes:

first: user select many skills using multiple checkbox , save selected data db table.

second: if click on category on fronted page php or java php or java related data information/list show.

how can please me or suggest me best.if possible provide me source code in codeignitor.

my applying code have look,

model,

public function selectaccoutingins() {         $this->db->select('*');         $this->db->select('skill');         $this->db->from('tbl_user_reg, tbl_course_offred');         $this->db->where('skill', "php");         // here, use 2 table 1 information collect , other category match condition value show.          $query_result = $this->db->get();         $result = $query_result->result();         $result = explode(",", $query_result->result);         return $result;      } 

controller,

function accounting_ins_list() {         $data = array();         $data['result'] = $this->welcome_model->selectaccoutingins();         $data['catepage_list'] = $this->load->view('accounting_ins_list', $data, true);         $this->load->view('hmcate_select_page', $data);     } 

view,

               <tbody>                     <?php                      if($result) {                     foreach ($result $aresult) {                     ?>                     <tr>                         <td><?php echo $aresult->institute_name;?></td>                         <td><?php echo $aresult->contact_person; ?></td>                         <td><?php echo $aresult->institute_address1;?></td>                     </tr>                     <?php }                       }   ?>                 </tbody> 

here want show php related information list.please how can solve this.

best regards,

you mean, if check php , accounting, appear view.? , have problem in selecting data 2 table?

you can visit on site in query data - http://ellislab.com/codeigniter/user-guide/database/active_record.html

i have example query here.

      $query = $this->db->query("select * logstrans l,transtype t                                  l.transno = t.transno                                 , t.transtype = '$cat'                                                                     , date(l.transdate) >= '$datef'                                  , date(l.transdate) <= '$datet'");              return $query->result(); 

can see table , data yo uwant get..? best regards...


Comments