Jump to content

[SOLVED] Advice needed about creating a php chat room!


npsari

Recommended Posts

 

Hi there,

 

I created a php chat room

There is only one thing missing

 

I dont know how to make the data show everytime someone types something

 

I have to reload the page to see if anything is saved in the database, so it shows in the chat room

 

i want to to be like a real chat room, everything shows when inserted by the user

 

How can i do that, can be done in php

The most basic way to do this is to set the header of the page to refresh every x seconds:

 

header( 'refresh: 5; url=/yoururl/' );

 

The main problem with this method is that it creates a lot of flicker on your page -- every time a page refreshes, it is going to be very noticeable and very slow for the user.

 

The solution to this is to use AJAX *ducks*.  This is a little bit beyond the scope of this site, but if you are serious about it you can just google "AJAX chat room tutorial". For example, this is the page I used to get started:

 

http://www.ajaxprojects.com/ajax/tutorialdetails.php?itemid=9

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.