用户
 找回密码
 入住 CI 中国社区
搜索
查看: 8819|回复: 4
收起左侧

[HELP] $this->db->order_by("id", "desc");到底怎么用???

[复制链接]
发表于 2013-10-1 13:34:41 | 显示全部楼层 |阅读模式
$this->db->order_by("id", "desc");
到底怎么用啊

在模型里写了这句
$query = $this->db->get_where('yule_wenzhang', "tags like '%$b%' or title like '%$b%'");
我就想和这句连上倒序排列?  放在各种位置都试了  还是ID 1 2 3这么排

 楼主| 发表于 2013-10-1 13:52:32 | 显示全部楼层
$query = $this->db->get_where('yule_wenzhang', "tags like '%$b%' or title like '%$b%'");$this->db->order_by("id", "asc");

这么写没作用啊
发表于 2013-10-1 18:29:42 | 显示全部楼层
建议将每一个条件都分开写。

$this->db->where();
$this->db->order_by("id", "desc");

$query = $this->db->get();
 楼主| 发表于 2013-10-1 18:45:10 | 显示全部楼层
本帖最后由 wuqian9871 于 2013-10-1 18:46 编辑

谢谢了 成功:)
发表于 2017-7-19 16:09:30 | 显示全部楼层
本帖最后由 寄语残云 于 2017-7-19 16:10 编辑

$query = $this->db->like( 'tags',  $b, 'both')->or_like('title', $b, 'both') ->order_by("id", "asc")->get('yule_wenzhang')->result_array();

本版积分规则