cpd Posted August 13, 2009 Share Posted August 13, 2009 Hello, I have created an Ajax/php chat however i have a problem because its not exactly what i want. Currently, my chat sneds off the http request and the php returns the last 80 messages entered into the database. This means that there are constantly 80 messages being output into the chat. I want to change this so that when the chat loads in the users browser, a 20 message buffer is output. The last 20 messages in the database. From then on, any new messages submitted to the database are simply "added" on top of the current ones in the chat. I have a feeling its something to do with taking whats already in the chat and just adding the comment on through javascript however, i have no idea how to check if the comments in the database have already been output or not. Every chat i have seen does this and its very similar to Messenger or Skype whereby the comments are just added. So to conclude id like to know how to: 1) tell if the comments have already been output and if not to output them. 2) the best way to output the new comments Regards Chris Thank you to anyone who helps and solves my currently dilema because i have quite literaly spent months on trying to figure this out and ive revised previous scripts etc etc and i just cant figure it out. Quote Link to comment Share on other sites More sharing options...
cpd Posted August 13, 2009 Author Share Posted August 13, 2009 Scrap this, i realised that if you make a timestamp and echo out all the messages after that timestamp then you have your chat 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.