title: store all leave to array
body: <p>I am trying to fetch all employee leave data to an array. But first leave data of my employee is replacing by last leave data. I do not want that. 
  my data set:</p>
  
  <pre><code>id   |  emp_id  |       leave_from  | leave_to
  2894    886             2019-11-26    2019-11-27    
  2896    1970            2019-11-20    2019-11-24        
  2897    1016            2019-11-23    2019-11-23    
  2898    1870            2019-11-10    2019-11-10    
  2899    1895            2019-11-09    2019-11-11    
  2900    1895            2019-11-23    2019-11-23                        
  2901    287             2019-11-27    2019-11-30    
  </code></pre>
  
  <p>my sql query: </p>
  
  <pre><code>$leave_sql = "SELECT l.* FROM 0_employee e right join (SELECT * FROM 0_leave_ledger WHERE (leave_approved_from &amp;&amp; leave_approved_to BETWEEN '".$fisrt_date."' AND '".$last_date."' )) l ON l.emp_id = e.emp_id where e.inactive=0";
  $leave = get_tb($leave_sql);
  $leave_date = array();
  foreach ($leave as $leave_d) {  
      $leave_date[$leave_d["emp_id"]]['type'] = $leave_d["leave_type"];
      $leave_date[$leave_d["emp_id"]]['lto'] = $leave_d["leave_approved_to"];
      $leave_date[$leave_d["emp_id"]]['lfrom'] = $leave_d["leave_approved_from"];
   }
  </code></pre>
  
  <p>let's look emp_id 1895.It has two rows in my data set. So I am expecting to insert those two rows in my array. But I am getting only last rows of data in my array. 
  my expecting output from <code>$leave_date</code> is: </p>
  
  <pre><code>[1895] =&gt; Array ( [type] =&gt; 4 [lto] =&gt; 2019-11-09 [lfrom] =&gt; 2019-11-11 ) 
  [1895] =&gt; Array ( [type] =&gt; 4 [lto] =&gt; 2019-11-23 [lfrom] =&gt; 2019-11-23 ) 
  </code></pre>
  
  <p>but I am getting only  </p>
  
  <pre><code>[1895] =&gt; Array ( [type] =&gt; 4 [lto] =&gt; 2019-11-23 [lfrom] =&gt; 2019-11-23 ) 
  </code></pre>