0

Can you give me an idea on how to implement chat room using PHP and MySQL?

Mat
  • 202,337
  • 40
  • 393
  • 406
srinivas
  • 360
  • 1
  • 5
  • 16
  • possible duplicate of [How to make a chat room script with PHP?](http://stackoverflow.com/questions/772471/how-to-make-a-chat-room-script-with-php) – Gordon Jul 30 '10 at 08:03

4 Answers4

3

You will probably want to use AJAX or if not that, Javascript with timer to make chat appear instant or with polled updates.

  1. (Chat text data fetched and displayed.) Form frontend fields accepts chat input
  2. Chat input sent to server via form. AJAX waits to receive data to update chat text display.
  3. Server updates a data queue (example - PHP dumps to MySQL). Data sent back to frontend via AJAX wrappers
  4. Repeat

There are lots of tutorials on creating something like this - including a number with AJAX i/o - http://css-tricks.com/chat2/

ina
  • 19,167
  • 39
  • 122
  • 201
1

The best you can do with php and mysql is create a bulletin board kind of system where people add comments to a "channel", then reload the page to update.

Gareth
  • 380
  • 3
  • 12
0

In general, I think, it is a bad idea to use PHP for this kind of project. Every client hast to reload the page (mentioned bulletin board e. g.) every few seconds to get informed about updates.

  • can you suggest me any other technology for implementing this. basically i can't this now because i've developed the entire app in php and need this – srinivas Jul 30 '10 at 08:05
0

If you want to code in PHP and a little javascript, try Jaxl library Web Chat sample application. Can be worked upon to build a full fledged chat systems. http://github.com/abhinavsingh/JAXL. XMPP protocol is the way today, when it comes to chat client :D

Abhinav Singh
  • 2,643
  • 1
  • 19
  • 29