I am having a problem with the below: When user write something in a textbox and sends it then this text is added to DB using AJAX and then shown on his screen using AJAX return as it is too much easy but problem is that how I will let the Admin know that any new message is received, well the admin is also connected to chat but I can update a user's screen on the event of INSERTING A MESSAGE TO DATABASE but how could I know the admin of this message. I have following idea in my mind to let the admin knows about it.
I am waiting for your helpful replies. Thanks in Advance. sweetguyzzz
When you're querying to see if there are new messages in the chat room from others you'll want to have the most recent row id that the client has. So if the client has message number 9001 you'll want to AJAX request to the server with the id 9001 and in PHP query if there are any messages from row 9002 or greater.
If you're using junk like innerHTML (does not properly register like anything in the DOM) you're not going to be able to reliably determine the row id's from AJAX loaded content so make sure you stick to using DOM based methods only.