title: Listing alphabets a to z only produces the first letter a
body: <p>I have the following code where I try to print alphabets from a to z in the first column. but I only get the letter "a" is printed through the entire column. </p>
  
  <pre><code>function print_table_tb ($conn, $id) {
      $sql = "SELECT stata,statb,statc FROM dbA";
      $result = $conn-&gt;query($sql);
      if ($result-&gt;num_rows &gt; 0) {
          echo "&lt;table class='tbr' id='tb$id'&gt;";
          while($row = $result-&gt;fetch_assoc()) {
              $data = array_reduce($row, function($carry, $value) {
                  $carry[] = "&lt;td dbval='{$value}'&gt;{$value}&lt;/td&gt;";
                  return $carry;
              }, []);
  
              $range = range('a', 'z');
              $i = 0;
  
              echo '&lt;tr&gt;&lt;td class="tbe"&gt;'.$range[$i++ % 26].'&lt;/td&gt;'. implode('', $data) . "&lt;/tr&gt;\n" ;
  
          }
  
          echo "&lt;/table&gt;";
      }
  }  
  </code></pre>
  
  <p>What am I doing wrong here? thanks for your help! My question is different. I don't seek a solution to get alphabetical listing, I have the solution, but I couldn't fix an error. </p>
  
  <p>I tried this but it doesn't work either. </p>
  
  <pre><code>function print_table_tb ($conn, $id) {
      $sql = "SELECT stata,statb,statc FROM dbA";
      $result = $conn-&gt;query($sql);
      if ($result-&gt;num_rows &gt; 0) {
  
          $range = array("a", "b", "c", "d");
          $i = 0;
  
          echo "&lt;table class='tbr' id='tb$id'&gt;";
          while($row = $result-&gt;fetch_assoc()) {
              $data = array_reduce($row, function($carry, $value) {
                  $carry[] = "&lt;td dbval='{$value}'&gt;{$value}&lt;/td&gt;";
                  return $carry;
              }, []);
  
  
              echo '&lt;tr&gt;&lt;td class="tbe"&gt;' . $range[$i] . '&lt;/td&gt;'
                  . implode('', $data) . "&lt;/tr&gt;\n" ;
              $i++;    
          }
  
          echo "&lt;/table&gt;";
      }
  }  
  </code></pre>