jQuery prepend a auto fetch php file database
- by newinjs
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.