title: I want some correction on my result using codeigniter
body: <p><a href="https://i.stack.imgur.com/a95Pb.jpg" rel="nofollow"><img src="https://i.stack.imgur.com/a95Pb.jpg" alt="now the output is getting like this. i marked what i needed"></a></p>
  
  <p>some rows have same date. i want to make that as one. for eg: 2016-11-02,afternoon English 1 and for noon English 11.now getting as two entries.please help me to make it as one row. I am sharing my model function here</p>
  
  <p>Model</p>
  
  <pre><code>public function select_data() {
      $this-&gt;db-&gt;distinct();
      $this-&gt;db-&gt;select('extt_std as std');
      $this-&gt;db-&gt;from('exam_time_table');
      $query = $this-&gt;db-&gt;get();
      if ($query-&gt;num_rows() &gt; 0) {
          foreach ($query-&gt;result() as $row) {
              $row-&gt;standard = $row-&gt;std;
              $data[] = $row;
  
              $this-&gt;db-&gt;select('*');
              $this-&gt;db-&gt;from('exam_time_table');
              $this-&gt;db-&gt;where('exam_time_table.extt_std', $row-&gt;std);
              $query = $this-&gt;db-&gt;get();
              $get = $query-&gt;result();
  
              foreach ($get as $row) {
                  if ($row-&gt;extt_sess == 'FN') {
                      $row-&gt;fornoon = $row-&gt;extt_sub;
                      $row-&gt;afternoon = '';
                  }
                  if ($row-&gt;extt_sess == 'AN') {
                      $row-&gt;fornoon = '';
                      $row-&gt;afternoon = $row-&gt;extt_sub;
                  }
                  $data[]=$row;
              }
          }
          return $data;
      }
      return false;
  }
  </code></pre>
  
  <p>my table</p>
  
  <pre><code>CREATE TABLE `exam_time_table` (
    `extt_id` int(10) NOT NULL,
    `extt_date` date NOT NULL,
    `extt_exam` varchar(20) NOT NULL,
    `extt_std` varchar(10) NOT NULL,
    `extt_sub` varchar(15) NOT NULL,
    `extt_sess` varchar(10) NOT NULL,
    `extt_year` varchar(10) NOT NULL
  ) 
  
  INSERT INTO `exam_time_table` (`extt_id`, `extt_date`, `extt_exam`, `extt_std`, `extt_sub`, `extt_sess`, `extt_year`) VALUES
  (1, '2016-11-01', 'Half Yearly', 'I-STD', 'Tamil', 'FN', '16-17'),
  (2, '2016-11-01', 'Half Yearly', 'II-STD', 'Tamil', 'FN', '16-17'),
  (3, '2016-11-01', 'Half Yearly', 'III-STD', 'Tamil', 'FN', '16-17'),
  (4, '2016-11-01', 'Half Yearly', 'IV-STD', 'Tamil', 'FN', '16-17'),
  (5, '2016-11-01', 'Half Yearly', 'XI-STD', 'Tamil-I', 'FN', '16-17'),
  (6, '2016-11-01', 'Half Yearly', 'X-STD', 'Tamil-I', 'FN', '16-17'),
  (7, '2016-11-01', 'Half Yearly', 'V-STD', 'Tamil', 'FN', '16-17'),
  (8, '2016-11-01', 'Half Yearly', 'VII-STD', 'Tamil', 'FN', '16-17'),
  (9, '2016-11-01', 'Half Yearly', 'VII-STD', 'Tamil', 'FN', '16-17'),
  (10, '2016-11-01', 'Half Yearly', 'VIII-STD', 'Tamil', 'FN', '16-17'),
  (11, '2016-11-01', 'Half Yearly', 'IX-STD', 'Tamil-II', 'AN', '16-17'),
  (12, '2016-11-01', 'Half Yearly', 'X-STD', 'Tamil-II', 'AN', '16-17'),
  (13, '2016-11-02', 'Half Yearly', 'I-STD', 'English', 'AN', '16-17'),
  (14, '2016-11-02', 'Half Yearly', 'II-STD', 'English', 'FN', '16-17'),
  (15, '2016-11-02', 'Half Yearly', 'IX-STD', 'English-I', 'FN', '16-17'),
  (16, '2016-11-02', 'Half Yearly', 'IX-STD', 'English-II', 'AN', '16-17'),
  (17, '2016-11-02', 'Half Yearly', 'X-STD', 'English-I', 'FN', '16-17'),
  (18, '2016-11-02', 'Half Yearly', 'X-STD', 'English-II', 'AN', '16-17'),
  (19, '2016-11-02', 'Half Yearly', 'III-STD', 'English', 'FN', '16-17');
  </code></pre>