0

助けが必要です。複数選択したチェックボックスの値に WHERE 条件句適用できませここでは、スキル テーブルのフィールド名と php チェックボックスで選択された値です。カテゴリ「PHP」を選択すると、すべての「PHP」関連データのみが表示されます。チェックボックスで選択された値は、「,」カンマで区切られてデータベースに保存されます。お気に入りphp,java,accounting,sql

モデルに使用したセーブデータの場合:

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

私が使用するコントローラーの場合:

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");
        }
    }

私のワークフローの好み:

最初: ユーザーは複数のチェックボックスを使用して多くのスキルを選択し、選択したデータを DB テーブルに保存します。

2 番目: 誰かが php や Java などのフロント ページのカテゴリをクリックすると、php または Java 関連のデータ情報/リストのみが表示されます。

どうすればこれを行うことができますか、私を助けるか、最善を提案してください。

私の適用コードを見て、

モデル、

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;

    }

コントローラ、

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);
    }

見る、

               <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>

ここでは、 PHP 関連の情報リストのみを表示したいのですが、これを解決する方法を教えてください。

よろしくお願いします、

4

1 に答える 1