title: Should I write php code in html page?
body: <p>Example I have a code select  data in sever</p>
  
  <pre><code>$sql = "SELECT * FROM ..."
  $result = mysqli_query($conn,$sql)
  $row = array()
  if($result){
  while($r = mysqli_fetch_assoc($result)) {
      $rows[] = $r;
  }
  </code></pre>
  
  <p>I often use ajax to show data in html . But I see some people render in html by php like </p>
  
  <p>index.html</p>
  
  <pre><code>&lt;div&gt; &lt;?php echo $row ?&gt; &lt;/div&gt;
  </code></pre>
  
  <p>I think it not good but i dont know why . Please explain for me. Many thanks </p>