jQuery prepend a auto fetch php file database

Posted by newinjs on Stack Overflow See other posts from Stack Overflow or by newinjs
Published on 2010-05-29T15:43:10Z Indexed on 2010/05/29 15:52 UTC
Read the original article Hit count: 229

Filed under:
|
|

Hello,

Currently i have a php file which fetch data from mysql to display in website.

I'm using input value to send as $_GET parameter to php file to determine the data to show.

mysql_query("SELECT * FROM messages WHERE msg_id>'$refID' ORDER BY msg_id DESC");
//$refID is input value

So once it load,

i'm using this jquery code to display it on website

setInterval(
function ()
{
$.get('load.php?id='+refID, function(html) { 
  $("ol#update").prepend(html);
  $("ol#update li:first").slideDown("slow");
});
}, 10000);

My question is how do i stop it from keep on repeating the same message? i want it to display if there is new data.

© Stack Overflow or respective owner

Related posts about php

Related posts about jQuery