wuqian9871 发表于 2013-10-1 13:34:41

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

$this->db->order_by("id", "desc");
到底怎么用啊

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

wuqian9871 发表于 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");

这么写没作用啊

dren_a 发表于 2013-10-1 18:29:42

建议将每一个条件都分开写。

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

$query = $this->db->get();

wuqian9871 发表于 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();
页: [1]
查看完整版本: $this->db->order_by("id", "desc");到底怎么用???