title: Php Auto Refresh Data in HTML
body: <p>I want to ask a question in php. I want to make a plan and changing values over it.
  I put a image and I put some datas over it. I want to refresh auto this values.</p>
  
  <pre><code>&lt;div class="container"&gt;
    &lt;img src="ahol.PNG" alt="Norway" style="width:100%;"&gt;
    &lt;div class="data1"&gt;$data1 kWh &lt;/div&gt;
   &lt;div class="data2"&gt;$data2 kWh &lt;/div&gt;
     &lt;div class="data3"&gt;$data3 kWh &lt;/div&gt;
   &lt;div class="data4"&gt;$data4 kWh &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>This is my getting data php code in same file;</p>
  
  <pre><code>$servername = "localhost";
  $username = "";
  $password = "";
  $dbname = "";
  
  // Create connection
  $conn = new mysqli($servername, $username, $password, $dbname);
  // Check connection
  if ($conn-&gt;connect_error) {
      die("Connection failed: " . $conn-&gt;connect_error);
  } 
  
  $sql = "SELECT * FROM makinebilgi";
  $result = $conn-&gt;query($sql);
  
  if ($result-&gt;num_rows &gt; 0) {
      // output data of each row
      while($row = $result-&gt;fetch_assoc()) {    
          $data1 =$row["data1"];
          $data2= $row["data2"];
          $data3= $row["data3"];
          $data4= $row["data4"];
      }
  } else {
      echo "0 results";
  }
  $conn-&gt;close();
  </code></pre>
  
  <p>This page I want to use energy system watch. I am adding energy values to database every second. I want to autorefresh only datas not page.</p>