我想使用CodeIgniter
从数据库中获取数据。
function fetch_chapter()
{
$this->db->select('*');
$this->db->from("chapter");
$this->db->join('unit','unit.unit_number = chapter.unit_number','left');
$this->db->order_by('chapter.unit_number','ASC');
$this->db->order_by('chapter_number','ASC');
$query = $this->db->get();
return $query;
}
我想要如下结果:
Unit 1
Chapter 1
Lesson 1
Lesson 2
Chapter 2
Lesson 1
Unit 2
Chapter 1
Lesson 1
Chapter 2
Lesson 1