title: PHP variable in $row[]
body: <p>Any idea how to include variable in $row[] mysqli_query?</p>
  
  <p>what I've tried until now:</p>
  
  <p>1  </p>
  
  <pre><code>$result = mysqli_query($connection, "SELECT ".$var." AS Variables, COUNT(*)  FROM data GROUP BY '$var'"); 
  while($row = mysqli_fetch_array($result)) {
      echo $row['Variables'];
      echo $row['COUNT(*)']; 
  }
  </code></pre>
  
  <p>2</p>
  
  <pre><code>$result = mysqli_query($connection, "SELECT '$var', COUNT(*)  FROM data GROUP BY '$var'"); 
  while($row = mysqli_fetch_array($result)) {
      echo $row[$var];
      echo $row['COUNT(*)']; 
  }
  </code></pre>
  
  <p>Also, I've tried all combination</p>
  
  <pre><code>echo $row[$var];
  echo $row["$var"];
  echo $row['$var'];
  </code></pre>