title: How do you add a variable Count on the end of a $row->variable?
body: <p>We are trying to make life easier on one of our website coded platforms.
  There are 8 rows in the database, each with 1-4 at the end of them.</p>
  
  <p>ie.  childrensrange1, childrensrange2 and so on.
  Then childrennumber1, childrennumber2...</p>
  
  <p>But I don't want to be creating a ton of code, so I have started writing this.  But I cannot work out how to assign the number to the end of the $row->variable.</p>
  
  <p>Look at the row starting with: $childrenamountrow
  I need it to query the database for $row->childrenamount1, then $row->childrenamount2 and so on.</p>
  
  <p>I'm sure I have done this before, but I cannot remember how to do it.
  This block should cover all 4 blocks of age ranges rather than reams of code for each set.</p>
  
  <pre><code>$countchild = 1;
  while ($countchild &lt;=4) {
      echo "&lt;tr&gt;&lt;td&gt;&lt;select name='childrensrange$countchild'&gt;";
      $querychildren = ("SELECT * FROM `childrensagerange` ORDER BY id");
      $resultchildren = $pdo-&gt;query($querychildren); 
      while ($rowchildren = $resultchildren-&gt;fetch(PDO::FETCH_OBJ)) { 
          $childrenrangerow = "$rowchildren-&gt;agerange"."$countchild";
          echo "&lt;option value='$rowchildren-&gt;agerange'";
          if ($rowchildren-&gt;agerange == $childrenrangerow) { echo " selected='selected'";}
          echo "&gt;$rowchildren-&gt;agerange&lt;/option&gt;";
      }
      echo "&lt;/td&gt;&lt;td&gt;";
      $childrenamountrow = "$row-&gt;childrenamount$countchild";
      echo "&lt;input type='text' name='childrenamount$countchild' value='$childrenamountrow'&gt;&lt;/td&gt;&lt;/tr&gt;";
      $countchild ++;
  }
  
  echo "&lt;/table&gt;```
  
  </code></pre>