Hello Masters,
I need help.I can't apply WHERE Condition clause in my Multiple selected checkbox value.like If i select 'accounitng' or 'php' then i want here use a condition like WHERE ("skill", "php") here, skill table field name and php checkbox selected value.If i select a category 'PHP' so all 'PHP' related data only show.Checkbox selected value save into databse with ' , ' comma separated. like php,java,accounting,sql
For save data i used for Model:
public function saveInstituteOfferCourse($data = array()) {
if ($this->db->insert('tbl_course_offred', $data)) {
return $this->db->insert_id();
}
return FALSE;
}
for controller i 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 and save selected data into DB table.
Second: if anyone click on category on fronted page like php or java then only php or java related data information/list show.
How can i do this please help me or suggest me for best.if possible provide me source code in codeignitor.
My applying code have a 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, i use two table 1 for information collect and other for 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 as $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 i want to show only PHP related information list.Please help how can i solve this.
Best regards,