title: How to display Serial Numbers with mysql query result in codeigniter?
body: <p>I want to display serial numbers beside my mysql query result , example:</p>
  
  <pre><code>Serial Number      Name          Country
    1.                John           USA
    2.                Srijon           UK
  </code></pre>
  
  <p>I have tried something with PHP Loops, but I couldn't make it work. Would you please kindly help me?
  please note that the serial numbers are not values retrieved from database.</p>
  
  <p>Thanks in Advance :)</p>
  
  <pre><code>            &lt;?php if(count($records) &gt; 0) { ?&gt;
              &lt;table id="table1" class="gtable sortable"&gt;
              &lt;thead&gt;
                      &lt;tr&gt;
                          &lt;th&gt;Batch Name&lt;/th&gt;
                          &lt;th&gt;Class&lt;/th&gt;
                          &lt;th&gt;Batch Instructor&lt;/th&gt;
                      &lt;/tr&gt;
              &lt;/thead&gt;
              &lt;tbody&gt;
              &lt;?php
              foreach ($records as $row){?&gt;
  
              &lt;tr&gt;
  
                &lt;td&gt; &lt;a href="&lt;?php echo base_url(); ?&gt;batch/&lt;?php echo $row['batchid']; ?&gt;"&gt;&lt;?php echo $row['batchname'];?&gt;&lt;/a&gt; &lt;/td&gt;
                  &lt;td&gt;&lt;?php echo $row['class'];?&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;?php echo $row['batchinstructor'];?&gt;&lt;/td&gt;
  
              &lt;/tr&gt;
  
          &lt;?php   } ?&gt;
  
              &lt;/tbody&gt;
              &lt;/table&gt;
              &lt;?php } ?&gt;
              &lt;div&gt; &lt;?php echo $this-&gt;pagination-&gt;create_links(); ?&gt; &lt;/div&gt;
  </code></pre>