I want to sort my database values in descending order using this query below in my model. However, it doesn't completely sort in descending order all the values in the database but when ascending is used, it works well.
function sort_all_courses_desc($tennant_id)
{
$this->db->select('*');
$this->db->where('tennant_id',$tennant_id);
$this->db->order_by("course_name","desc");
$this->db->from('courses');
$query=$this->db->get();
return $query->result();
}