title: How to make dynamic rowspan codeigniter?
body: <p>I have table rowspan dynamic on CodeIgniter app like this :</p>
  
  <pre><code>&lt;table&gt;
  &lt;tr&gt;
      &lt;td&gt;No&lt;/td&gt;
      &lt;td&gt;Data 1&lt;/td&gt;
      &lt;td&gt;Data 2&lt;/td&gt;
      &lt;td&gt;Qty&lt;/td&gt;
      &lt;td&gt;Data 3&lt;/td&gt;
  &lt;/tr&gt;
  &lt;?php
  
  $source1 = $this-&gt;db-&gt;query("select * from table")-&gt;result_array(); 
  $no=1;
  foreach($source1 as source1){ ?&gt;
      &lt;tr&gt;
          &lt;?php 
          $source2 = $this-&gt;db-&gt;query("select * from table where data1='$source1[data1]'");
          $total_source2 = $source2-&gt;num_rows();
          $source3 = $source2-&gt;result_array();
          ?&gt;
          &lt;td rowspan="&lt;?php echo $total_source2 ?&gt;"&gt;&lt;?php echo $no; ?&gt;&lt;/td&gt;
          &lt;td rowspan="&lt;?php echo $total_source2 ?&gt;"&gt;&lt;?php echo $source1['data1']; ?&gt;&lt;/td&gt;
          &lt;?php foreach($source3 as $source3){ ?&gt;
              &lt;td&gt;&lt;?php echo $source3['data2'] ?&gt;&lt;/td&gt;
              &lt;td&gt;&lt;?php echo $source3['qty'] ?&gt;&lt;/td&gt;
              &lt;td&gt;&lt;?php echo $source3['data3'] ?&gt;&lt;/td&gt;
          &lt;/tr&gt;
      &lt;?php } ?&gt;
      &lt;?php $no++; } ?&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>This is result of my code:</p>
  
  <p><a href="https://i.stack.imgur.com/z50K0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/z50K0.png" alt="table 1"></a></p>
  
  <p>How to make it like this :</p>
  
  <p><a href="https://i.stack.imgur.com/NCnoo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NCnoo.png" alt="table 2"></a></p>
  
  <p>?</p>
  
  <p>Thanks</p>