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 592937
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T15:47:32+00:00 2026-05-13T15:47:32+00:00

Environment : PHP/MySQL/Jquery I would like to refresh the page (ex: index.php) when new

  • 0

Environment : PHP/MySQL/Jquery

I would like to refresh the page (ex: index.php) when new data stores in to the table (ex : new_entry_table) checking for every one minute. The same page will be opened in many machines(pc-browsers) at a time all should get refresh when new data arises.

using jquery and database check i tried the following:

setInterval(function(){
$.post("new_data_check.php", function(data) { 
   if(data > 0){ 
       $("#container").fadeOut('fast').load(location.reload());
   } 
   });
   return false;
},60000);

new_data_check.php:
: checks
for new data in the test_db where
newdata_field=0 ;
: If any new
data arises echo “1”; And update the
newdata_field=1; to stop constantly
refreshing the page.
: else echo
“0”;
: Just for a trigger

So the above jquery code checks new_data_check.php every 1 min for the trigger , if any trigger arises it will refresh the container.But its getting refresh only one opened session other opened sessions(in other browser or other pc) not getting refreshed.

Suggest a better way to do this. Thanks.

  • 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-05-13T15:47:33+00:00Added an answer on May 13, 2026 at 3:47 pm

    Your new_data_check.php file will need to keep track of all the users that are independently viewing the page.

    If not, this will happen:

    • User 1 and User 2 are both logged into the site.
    • User 1 does the check 5 seconds before User 1, there is new data.
    • User 1 completes his request. The server clears the new_data bit.
    • User 2’s request arrives 5 second later. Hedoes his request, but at this point, User 1 has set the new_data field to 0. His data is stale, but User 1 has effectively co-opted him.

    By the looks of it, you’re not supplying it with any information that would identify the user – unless the server is determining that using the IP address. If that’s the case, remember that it’s likely everyone behind a small network is going to have the same external ip address. So it can’t tell people at an office apart.

    What you could do is generate some kind of unique hash for each session and pass that off to the browser. The javascript can then provide the php script that same token.

    Another solution without any sort of special bit, would be to pass along a timestamp with the request. Essentially, the client says “my latest bit of data arrived at 9:21:53 PM” The server then checks and responds “My most recent data was created before that, so you’re still good. ” or “I’ve got something that was created or modified on 9:22:53PM, you should download it.”

    With that method, you don’t need to worry about who’s who. Instead, you need to have modification/creation times on the data you’re checking for staleness. You also need to make sure that the clients clock is synchronized correctly – better yet, don’t trust the clients date and time information. Maybe utilize your new_data_check.php to provide the script with a timestamp it can pass along on subsequent requests.

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

Sidebar

Ask A Question

Stats

  • Questions 406k
  • Answers 406k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The Problem: This XML document has a default namespace. XPath… May 15, 2026 at 6:11 am
  • Editorial Team
    Editorial Team added an answer Since you're using stl, I'd use vector< pair<int,int> > (or… May 15, 2026 at 6:11 am
  • Editorial Team
    Editorial Team added an answer If you implement an abstract class and don't implement all… May 15, 2026 at 6:11 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.