S
S
semki0962016-03-22 21:38:44
MySQL
semki096, 2016-03-22 21:38:44

How to sort data in reverse order in a query?

I extract the last 3 comments by query. Question - how now these 3 comments are sorted in reverse order?

$this->db->order_by('id DESC');
                $limit = 300;
                $offset = 3;
                $query = $this->db->get_where('comments', array('id' => id), $limit, $offset);
                return $query->result_array();

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Evgeniy _, 2016-03-22
@semki096

array_reverse($array, true);
It won't work?
ps: php.net/manual/en/array.sorting.php

S
synapse_people, 2016-03-22
@synapse_people

$this->db->order_by('id ASC');

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question