Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9121889
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T05:57:53+00:00 2026-06-17T05:57:53+00:00

I have a page, the contents are gotten dynamically with php and Mysql.I use

  • 0

I have a page, the contents are gotten dynamically with php and Mysql.I use a foreach loop to display all the content.

foreach($data as $key){
            echo "<div id="post_content"> $key['post'] </div>";
      }

Now I get my feed just as it is, but the problem here is, the page needs to be refreshed before you see new post rows from the database.
This is where twitter comes in, when you’re on twitter and there’s a new post from someone you are following, it shows “1 new tweet” at the top of the feed, when you click this it adds the content of the tweet to the feed.
From my research, i’ve found a couple of ways to do this;

  1. Websockets. Cons: Cross browser compatibility.

  2. Using AJAX: refresh = setInterval(function(), 5000); Cons: Well, loading a script every 5 second :/

  3. Someone recomended socket.io to me and i’m still looking at how to integrate it with php.

My questions is, is there any other effective(prefarably simple and effecient) way of doing this?
Any help would be greatly appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T05:57:54+00:00Added an answer on June 17, 2026 at 5:57 am

    The problem is that anything socket related has a limit to the amount of connections opened at a particular point in time. So if you’re not planning to serve tens of thousands of concurrent duplex connections then you’re better off using a combination of AJAX and JSON with your PHP.
    I recommend you implement polling intervals. eg, when a user isn’t active after a certain amount of time, increase the interval or assuming nothing new shows up for 5- 10 polls, increase the interval, perhaps doubling it every time until it reaches, let’s say, 2 mins. On getting a message or value back, reduce the intervals back to 5 seconds or less.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

lets say i have two pages links.html & contents.php ... first page contains only
My current task is an ASP.NET page to display the contents of a data
I have stored page contents (tables, plain text, images and paragraphs) into a variable.
I have this serious: I have ASP.NET page, This page contents Update panel with
On my web site I have XMLs with my page contents (automatically generated from
I have a page where its meta-contents are deriving from view.yml file. <meta name=robots
I have a page with 10 different div contents in it. Based on my
I have created a page on Wiki and I want to make the contents
I have the contents of a web page assigned to a variable $html Here's
I have a content page(Say.. invoice.aspx) in asp.net application with master pages. The content

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.