title: I need an interval of 3 seconds to execute each mysql_query
body: <p>I'm doing a simple chat and everything is working well, but everybody can flood the chat sending how many messages they want to...</p>
  
  <p>PHP:</p>
  
  <pre><code>&lt;div id="chat_panel"&gt;&lt;/div&gt;
  &lt;br /&gt;
  &lt;table border="0" cellspacing="0" cellpadding="0"&gt;
  &lt;tr&gt;
  &lt;td&gt;&lt;input type="text" autocomplete="off" maxlength="50" placeholder="Type your message..." id="message" size="87%" checked="yes"&gt;&lt;/td&gt;
  &lt;td&gt;&lt;input type="button" id="message" onClick="sendMessage()" value="Send"&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>JAVASCRIPT:</p>
  
  <pre><code>function sendMessage() {
  var message = $('#message').val();
  $.post('postMessage.php', { message: message } , function() { } );
  }
  </code></pre>
  
  <p>postMessage.PHP:</p>
  
  <pre><code>session_start();
  include ("chats/connect.php");
  $timname = $_SESSION['username'];
  if (isset($_POST['message'])) {
  mysql_query("INSERT INTO chat VALUES ('', '".$timname."', '".$_POST['message']."', '".time()."', NOW(), '');");
  }
  </code></pre>
  
  <p>I need to set a interval to send each message like 3 seconds...
  Any information will be helpful!</p>