**CI中的order_by在get_where之前

简介: public function show_list_by_order($array_data, $order_field, $order_mode) { $query = $this->db->get_where('xm_attach', $array_data); ...

public function show_list_by_order($array_data, $order_field, $order_mode)
{
$query = $this->db->get_where('xm_attach', $array_data);
$this->db->order_by($order_field, $order_mode);
//row_array取一行数据;result_array 取多行数据
return $query->result_array();

}

 

上面的写法是错误的,需要更改下顺序:

public function show_list_by_order($array_data, $order_field, $order_mode)
{

$this->db->order_by($order_field, $order_mode);
$query = $this->db->get_where('xm_attach', $array_data);
//row_array取一行数据;result_array 取多行数据
return $query->result_array();

}

如何联系我:【万里虎】www.bravetiger.cn 【QQ】3396726884 (咨询问题100元起,帮助解决问题500元起) 【博客】http://www.cnblogs.com/kenshinobiy/
目录
相关文章
|
10月前
Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation
Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation
64 0
|
关系型数据库 MySQL 数据库
Mysql case 视图操作报错 1267 Illegal mix of collations (utf8mb4_unicode_ci,COERCIBLE)……
Mysql case 视图操作报错 1267 Illegal mix of collations (utf8mb4_unicode_ci,COERCIBLE)……
223 0
Mysql case 视图操作报错 1267 Illegal mix of collations (utf8mb4_unicode_ci,COERCIBLE)……
|
数据库
Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8mb4_general_ci,COERCIBLE)
版权声明:本文为 testcs_dn(微wx笑) 原创文章,非商用自由转载-保持署名-注明出处,谢谢。 https://blog.csdn.net/testcs_dn/article/details/82016025 Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8mb4_general_ci,COERCIBLE) for operation 'like' 这个问题一看就是编码的问题。
6325 0
|
SQL 关系型数据库 MySQL
order by使用
order by使用
153 0
order by使用
CRM_ORDER_PR_ASSIGN_SELECT_CB
Created by Wang, Jerry, last modified on Mar 10, 2017
73 0
CRM_ORDER_PR_ASSIGN_SELECT_CB
|
SQL 关系型数据库 MySQL
mysql: Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation '= 的解决
昨天把mysql里所有table的varchar字段的字符集,批量换成了utf8mb4/utf8mb4_unicode_ci ,以便能保存一些emoji火星文 , 结果有一个sql语句执行时,报错如下: Illegalmixofcollations (utf8_unicode_ci,IMPLICI...
2119 0
|
监控 测试技术 持续交付
update issue a join TABLE b on on a.id=b.isid set a.group_date= b.groupDate
update issue a join TABLE b on on a.id=b.isid set a.group_date= b.groupDate update issue a join (SELECT iss.
816 0