本文介绍了操作的归类的非法混合'='的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从表'invoice_data'中选择数据,其中公司名称的值将通过电子邮件的值从表'crm_accounts'中选择。我收到的错误像



操作'='的非法混合排序规则(utf8_unicode_ci,IMPLICIT)和(utf8_general_ci,IMPLICIT) >

这是我的模型代码:

  public function view_invoice b $ b {
$ this-> db-> select('invoice_data。*,crm_accounts.company');
$ this-> db-> from('invoice_data');
$ this-> db-> join('crm_accounts','invoice_data.cname = crm_accounts.company','inner');
$ this-> db-> where('crm_accounts.email',$ email);
$ query = $ this-> db-> get();
return $ query-> result_array();
}


解决方案

>

  public function view_invoice($ email)
{
$ this-> db-> select('invoice_data 。*,crm_accounts.company');
$ this-> db-> from('invoice_data');
$ this-> db-> join('crm_accounts','invoice_data.cname = crm_accounts.company COLLATE utf8_unicode_ci','inner');
$ this-> db-> where('crm_accounts.email',$ email);
$ query = $ this-> db-> get();
return $ query-> result_array();
}


I want to select data from table 'invoice_data' where the value of company name will be choosen from the table 'crm_accounts' by value of email. I am getting error like

Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation '='

This is my model code:

public function view_invoice($email)
    {
        $this->db->select('invoice_data.*, crm_accounts.company');
        $this->db->from('invoice_data');
        $this->db->join('crm_accounts', 'invoice_data.cname = crm_accounts.company', 'inner');
        $this->db->where('crm_accounts.email', $email);
        $query = $this->db->get();
        return $query->result_array();
    }
解决方案

try this;

public function view_invoice($email)
{
    $this->db->select('invoice_data.*, crm_accounts.company');
    $this->db->from('invoice_data');
    $this->db->join('crm_accounts', 'invoice_data.cname = crm_accounts.company COLLATE utf8_unicode_ci', 'inner');
    $this->db->where('crm_accounts.email', $email);
    $query = $this->db->get();
    return $query->result_array();
}

这篇关于操作的归类的非法混合'='的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-14 08:33