title: Problem with setInterval when i LIMIT mysql rows
body: <p>I've made simple chat with setInterval that will load everything from <code>if($q == &quot;load&quot;) {</code>, and everything works fine but when i want to limit rows from db, for example i want my chat to show only last five, i change this line:</p>
  <p><code>$load = DB::getInstance()-&gt;query(&quot;SELECT * FROM chat WHERE id &gt; $data&quot;);</code></p>
  <p>to this</p>
  <p><code>$load = DB::getInstance()-&gt;query(&quot;SELECT * FROM chat WHERE id &gt; $data ORDER BY id DESC LIMIT 5&quot;);</code></p>
  <p>The setLimiter goes crazy and starts to add every second 5rows + 5rows + 5...etc and they are not the same, it just adds 5 on top every second even when i limit it.</p>
  <p>I want to make it to show only last five rows and thats it. I know its simple but looks like ive made mistake somewhere.</p>
  <p><strong>EDIT:</strong></p>
  <p>This is where i am so far:</p>
  <p><a href="https://jsfiddle.net/hg6m32ys/1/" rel="nofollow noreferrer">https://jsfiddle.net/hg6m32ys/1/</a></p>
  <p>Now when i type message, it goes on top (showing oldest first) until i refresh page, then they go from newest. And limiter is working only on refresh, before that it will display more then 5 messages.</p>
  <p>Here you can check demo: <a href="https://www.zlatniglas.rs/chat.php" rel="nofollow noreferrer">https://www.zlatniglas.rs/chat.php</a></p>