title: Increament id of td by Loop and getting id in function
body: <p>I'm populating a table with database data, i want to get value of td that is row<a href="https://i.stack.imgur.com/O7wDI.png" rel="nofollow noreferrer">1</a>, to perform action in PHP function, I dont know how to do this, </p>
  
  <pre><code>    &lt;?php
               $sql = "SELECT DISTINCT name,c_no,email,speciality FROM doctor_temp";
      $result = mysqli_query($con,$sql);
                     while ($row = mysqli_fetch_array($result))
  
  
  
                  {?&gt;
                      &lt;?php $count=1;
                              $count++;?&gt;
                     &lt;tr&gt;
                     &lt;td&gt;&lt;?php echo $row[0];?&gt;&lt;/td&gt;
                     &lt;td id=&lt;?php echo $count;?&gt;&gt;&lt;?php echo $row[1];?&gt;&lt;/td&gt;
                     &lt;td&gt;&lt;?php echo $row[2];?&gt;&lt;/td&gt;
                     &lt;td&gt;&lt;?php echo $row[3];?&gt;&lt;/td&gt;
                     &lt;td&gt;&lt;button type="button" class="btn btn-success" onclick="insert()"&gt;register&lt;/button&gt;&lt;/td&gt;
  
                     &lt;/tr&gt;
                &lt;?php  } ?&gt;
              &lt;/tbody&gt;
            &lt;/table&gt;
          &lt;/div&gt;
   &lt;script type="text/javascript"&gt;
          function insert()
          {
             var a = document.getElementById($count).innerHTML;
             alert(a)
          }
      &lt;/script&gt;
      &lt;/body&gt;
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/O7wDI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/O7wDI.png" alt="click on the register button to get corresponding number"></a></p>