简体   繁体   中英

Let me know solution because something wrong in my codeigniter model

Error Number: 1054

Unknown column 'Array' in 'where clause'

SELECT `cat_name` FROM (`cat_manager`) WHERE `parent_id` = Array

If you are using codeigniter then why don't you use codiegniter active record library to make the SQL queries writing them as plain SQL.

$select = $this->db->select('cat_name')
               ->from('cat_manager')
               ->where_in('parent_id', $yourArray);

$result = $this->db->get()->result_array();
    public function function_name()
    {
        $data = $_POST['input field name'];//align variable to data

        $query = $this->db->query("SELECT cat_name FROM cat_manager WHERE parent_id='$data'");//retrieve single item which  is equal to $data
        $result = $query->result_array();//asign it has objective array
        return $result;//return array
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM