title: Mysql with ajax
body: <p>Here is my code that I'm using.</p>
  
  <p><strong>ajax</strong></p>
  
  <pre><code>$.ajax({
      type: "GET",
      url: "process.php",
      dataType: "html",
      success: function(data){
          $(".content").html(data);
      }
  });
  
  $("#submit").click(function(){
      $.ajax({
          type: "POST",
          url: "post.php",
          dataType: "html",
          success: function(data1){
              $(".content").html(data1);
          }
      });
  });
  </code></pre>
  
  <p><strong>process.php</strong></p>
  
  <pre><code>&lt;?php
  $db = mysqli_connect("localhost","root","","webcap");
  $query = mysqli_query($db,"SELECT * FROM test");
  while($row = mysqli_fetch_assoc($query)){
      echo $row['num'];
  }
  </code></pre>
  
  <p><strong>post.php</strong></p>
  
  <pre><code>&lt;?php
  $db = mysqli_connect("localhost","root","","webcap");
  $num_query = mysqli_query($db,"SELECT * FROM test");
  $num_row = mysqli_fetch_assoc($num_query);
  $number = $num_row['num'];
  
  $new_number = $number + 1;
  $query2 = mysqli_query($db,"UPDATE test SET num='$new_number'");
  echo $new_number;
  </code></pre>
  
  <p>The idea is when i click button it add plus one to my database and i can see it without refreshing but others don't.</p>
  
  <p>I want that everyone in my website see it in real time without refreshing</p>