balkan7 Posted May 14, 2009 Share Posted May 14, 2009 Hi, Does someone can help me with this code to get the results that the messages is displayed one time and do not duplicate it, if it be shown whether it is possible to change the status, for example, if status of message in datebase is 1 after it is shown to change the status of the 2? ajax.js function display_msg(){ doc_id("new_msg").innerHTML="<br />"; makeHttpRequest(siteurl+"/ajax.php?a=new_msg",function(response){doc_id("new_msg").innerHTML+=response;},false); setInterval("display_msg()", 10000); } php <?php $result = mysql_query("SELECT * FROM ".DB_CHAT." WHERE status='1' ORDER BY date LIMIT 0,1"); while($data = mysql_fetch_array($result)){ $user = $data['user']; $msg = $data['msg']; echo $user." - ".$msg; } ?> Quote Link to comment Share on other sites More sharing options...
balkan7 Posted May 14, 2009 Author Share Posted May 14, 2009 hello guys, how can i get messages one by one from datebase without duplicate it ???? Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted May 14, 2009 Share Posted May 14, 2009 What do you mean without duplicating it? Check if your DB table has multiple entries. If so, maybe you should fix the part of the script that INSERTs data rather than fixing this AJAX. Quote Link to comment Share on other sites More sharing options...
balkan7 Posted May 15, 2009 Author Share Posted May 15, 2009 Here is explame, when user send msg status in datebase is 0, when i confirm msg for show it then status is 1, and ajax check in datebase messages with status 1, if find show it but if we havent new messages ajax do not show nothing ... like: msg 10 msg 9 msg 8 i hope undestand me ... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.