字符编码不一致问题

$nametogbk = mb_convert_encoding($name, 'gbk', 'utf-8');
$operation = mb_convert_encoding("name=:name", 'gbk', 'utf-8');//添加编码转换即可
$res = $this->getSingleFiledValuesUsePH('id,poster', $this->poster_table, $operation, ['name' => $nametogbk]);



 

 

关于mysql错误:Illegal mix of collations for operation

 

上面查的gbk表,代码下面切换了utf8的字符集的数据库表,循环的下一个查询时候没有切过来