Jump to content

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


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

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.