Jump to content

Live page updates


Go to solution Solved by Jacques1,

Recommended Posts

Hi there I'm a little bit of a newbie when it comes to PHP, and I have tried to find my answer on google and on other websites related to php development. 

 

My question is what do I need to be researching / learning to automatically update a page with content. 

 

For example, if I have a database field called breaking news and this text string is flashed at the bottom of the screen on a scrolling bar.

 

When the field changes value in MYSQL, I would like the page to automatically update the page without a need for a page refresh.

 

All I need is some advice on what I need to search for in order for me to learn the coding myself.

 

I'm thinking AJAX, but not too sure. 

 

Thank you for reading.  

Link to comment
https://forums.phpfreaks.com/topic/291386-live-page-updates/
Share on other sites

  • Solution

There are various techniques to implement this. The easiest way is to update the page every n seconds using Ajax. For example, every 5 seconds you would fetch the current text from the server and insert it into the page.

 

It's also possible to actively push the new content to the client, but this is harder to implement and comes with various issues, so it's not recommended unless you specifically need “real time” updates.

Edited by Jacques1
Link to comment
https://forums.phpfreaks.com/topic/291386-live-page-updates/#findComment-1492502
Share on other sites

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.