title: Display all entries in a table using for loop in PHP
body: <p>I want to display all entries present in a table in my MySQL database using <code>for</code> loop (I need <code>for</code> loop for some reason, <code>while</code> loop is not an option). Although I can do it properly in <code>while</code> loop I can't seem to manage to do it with <code>for</code> loop.</p>
  
  <p>Here is my while loop code</p>
  
  <pre><code>while ($row = mysqli_fetch_array($query))  
  {
      echo "&lt;p&gt; " . $row['column-name'] . " &lt;/p&gt;";
  }
  </code></pre>
  
  <p>How can I convert this to <code>for</code> loop? I mean how to navigate to each rows using for loop's counter variable?</p>
  
  <pre><code>$counter = mysqli_num_rows($result);    
  
  for ($i = $counter; $i &gt; 0; $i--) 
  { 
      echo ????;
  }
  </code></pre>
  
  <p>How should I echo the column name and use the <code>$i</code> as the row reference?</p>