title: cannot match date day based on array data on database on php
body: <p>I have a leave date data in one month with various types of dates I try to match the data by date this month. when I make it based on row data only one date appears. I am a little less aware of the logic if it is an array.</p>
  
  <p>My table</p>
  
  <pre><code>   | ID  |   id   |  start_date  |   end_date   | 
     | ____|________|______________|______________|
     |  1  |   x1   |  2018-11-05  |  2018-11-05  |
     |  1  |   x1   |  2018-11-12  |  2018-11-15  |
     |  3  |   x1   |  2018-11-19  |  2018-11-21  |
  </code></pre>
  
  <p>My script</p>
  
  <pre><code>    $timesheet = $this-&gt;db-&gt;select('*')
                        -&gt;where('MONTH(start_date)', 11)
                        -&gt;where('YEAR(start_date)', 2018)
                        -&gt;where('id', 'x1')
                        -&gt;get();
      $result = $timesheet-&gt;row_array();                    
      $day_start=date_create($result['start_date']);
      $day_end=date_create($result['end_date']);      
  
      for ($x = 1; $x &lt;= 30; $x++) {
          if($x &gt;=$day_start-&gt;format('d') and $x &lt;= $day_end-&gt;format('d')){
             echo "&lt;td class='bg-warning'&gt;Y&lt;/td&gt;";
          }else{
              echo "&lt;td&gt;N&lt;/td&gt;";
          }
      }   
  
      /** MY result data **/
  
      | Date  | ... | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | ... | 
      ----------------------------------------------------------------
      | Result| ... | N |  N |  N |  Y | Y  | N  | N  |  N |  N | ... |
  
  
      /** the results I expected **/
      | Date  | ... | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | ... | 
      ----------------------------------------------------------------
      | Result| ... | N |  Y |  N |  Y | Y  | N  | Y  |  Y |  Y | ... |
  </code></pre>