title: Notification when new record is added in database php-jquery
body: <p>I need advice about the title above. I have the following piece of code : </p>
  
  <p><strong>PHP :</strong></p>
  
  <pre><code>$sql = "SELECT * FROM i_case";
  $qry = pg_query($connection, $sql);
  $res = pg_num_rows($qry);   
  
  $sql_1 = "SELECT * FROM i_case";
  $qry_1 = pg_query($connection, $sql_1);
  $res_1 = pg_num_rows($qry_1);
  
  do {
      echo "new record on i_case";
  } while($res !=  $res_1 and !(usleep(10000)));
  </code></pre>
  
  <p><strong>JQUERY :</strong></p>
  
  <pre><code>setInterval(function(){    
      $.ajax({
          type : "POST",
          url : "file.php",
          success : function(response){
              alert(response);
          }
      });
  },1000);
  </code></pre>
  
  <p>It's not work that I expecting.</p>
  
  <p>I don't know where is the matter from the code?</p>