1

私の目標は、クエリ文字列を数値に置き換えることです。データベースからクエリ文字列を取り出して配列に挿入して、検索を実行できるようにしようとしています。

このファイル拡張ファイルは、MY_Input.php と呼ばれる core/ にあります。

class MY_Input extends CI_Input {


   function save_query($query_array) {

    $CI =& get_instance();

    $CI->db->insert('ci_query', array('query_string' => http_build_query($query_array)));

    return $CI->db->insert_id();
}

function load_query($query_id) {

    $CI =& get_instance();

    $rows = $CI->db->get_where('ci_query', array('id' => $query_id))->result();
    if (isset($rows[0])) {
        parse_str($rows[0]->query_string, $_GET);       
    }

}

}

データベースから文字列を取得し、次のようにコントローラー ページにロードしようとしています。

this->input->load_query($query_id); 


    $query_array = array(
        'fan_type_options'=>$this->input->get('fan_type_options'),
        'fan_motor_type' => $this->input->get('fan_motor_type'),
        'fan_ac_voltage' => $this->input->get('fan_ac_voltage'),
        'fan_cfm' => $this->input->get('fan_cfm'),
        'part-no' => $this->input->get('part-no'),
    );

配列をダンプすると、値はありませんが、最初の関数は機能し、次のようなクエリ文字列をキャプチャできます。

fan_type_options=Blower&fan_motor_type=EC&fan_ac_voltage=&fan_cfm=&part-no=

しかし、2 番目の関数をデバッグする方法がわかりません。私が間違っていること、または関数をデバッグする方法があるかどうかを誰かに教えてもらえますか。

4

0 に答える 0