title: How do I auto-refresh my php chat-script?
body: <p>I am having trouble getting my php chat script to auto refresh when mysql data is changed. I have done a good bit of research and it seems a lot of other people's solutions are more complicated then what I need (I'm going for something very basic).</p>
  
  <p>I do not know any javascript so detailed comments would be appreciated if js is involved.</p>
  
  <p>Here is the php script that I have created. It is functioning (at least for me).
          
  
  <pre><code>    include 'connect2.php';
      echo "
              Enter a Message:
              &lt;form method=post action='' name=chat&gt;
              &lt;input type=text name=message&gt;
              &lt;input type=submit name=chat value=Submit&gt;
              &lt;/form&gt;
      ";
  
      if (isset($_POST['chat'])) {
      $message = $_POST['message'];
      mysql_query("INSERT INTO chat set message='$message',user='$_SESSION[username]'");
      }
  
      $sql = "select * from chat order by id desc limit 15";
      $result = mysql_query($sql) or die ("An error has occured with in the database.");
  
      while ($data = mysql_fetch_assoc($result)) {
      $db_message = $data['message'];
      $db_user = $data['user'];
      echo "$db_user : $db_message &lt;br&gt;";
      }
  
      ?&gt;
  </code></pre>
  
  <p>Any help would be appreciated, thanks! :)</p>