npsari Posted October 14, 2007 Share Posted October 14, 2007 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 Quote Link to comment https://forums.phpfreaks.com/topic/73248-solved-advice-needed-about-creating-a-php-chat-room/ Share on other sites More sharing options...
cheechm Posted October 14, 2007 Share Posted October 14, 2007 I think AJAX would be the answer to that. There is probably other ways.. but that is what I would do. Quote Link to comment https://forums.phpfreaks.com/topic/73248-solved-advice-needed-about-creating-a-php-chat-room/#findComment-369528 Share on other sites More sharing options...
npsari Posted October 14, 2007 Author Share Posted October 14, 2007 i think AJAX only loads part of the script without loading the page but iam not sure if AJAX will show automatically everything inserted Quote Link to comment https://forums.phpfreaks.com/topic/73248-solved-advice-needed-about-creating-a-php-chat-room/#findComment-369531 Share on other sites More sharing options...
Mirkules Posted October 14, 2007 Share Posted October 14, 2007 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 Quote Link to comment https://forums.phpfreaks.com/topic/73248-solved-advice-needed-about-creating-a-php-chat-room/#findComment-369533 Share on other sites More sharing options...
MadTechie Posted October 14, 2007 Share Posted October 14, 2007 ajax on a timer would work Quote Link to comment https://forums.phpfreaks.com/topic/73248-solved-advice-needed-about-creating-a-php-chat-room/#findComment-369534 Share on other sites More sharing options...
npsari Posted October 14, 2007 Author Share Posted October 14, 2007 thanks guys hey, thanks for the tutorial that is a nice one, exatly what iam after i will read it Quote Link to comment https://forums.phpfreaks.com/topic/73248-solved-advice-needed-about-creating-a-php-chat-room/#findComment-369537 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.