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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T21:48:27+00:00 2026-05-15T21:48:27+00:00

Can someone explain how to create a .php page which auto-updates with values from

  • 0

Can someone explain how to create a .php page which auto-updates with values from a database? Would using AJAX be best for something like this? I want this PHP code, but I want the page to be updated whenever ‘values01’ is added to or changed, without having to refresh the page.
$query = "SELECT values01 FROM users WHERE username='$username'";
$result = mysql_query($query);
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
echo nl2br("{$row['values01']}");
}

Any help would be 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-05-15T21:48:28+00:00Added an answer on May 15, 2026 at 9:48 pm

    What you are describing would be a push notification from the web server. Unfortunately, I have not found a reliable way to do a traditional push, where the web server would initiate the connection with the client (from my limited research, it appears that there were proposals for the http standard to support push, however, it doesn’t look like a widely adopted standard ever emerged). However, this can be done in a bit more roundabout way.

    There is a way around the push limitation that is typically used:

    1. Browser connects to the page, loads up the current “state” of the database. A session variable (lets call it $_SESSION[‘currentState’]) is saved with the starting state of the database. A javascript timer on the client’s browser starts ticking down (lets just say that timer is 10 seconds long).
    2. Once the timer expires, an AJAX call is made to a script on the server. Lets call that script “updateValues.php”. updateValues.php checks the new state of the database. If the database differs from $_SESSION[‘currentState’], we return whatever changes have been made, in some nice form (json, xml, etc..), and update $_SESSION[‘currentState’] with the new state. If there was no change, we reply with something to that extent.
    3. Upon receiving the data, the browser executes some javascript that then updates the rendering in the browser if changes have been made to the db, and then restarts the timer.
    4. goto 2.

    The only thing you are missing here from a typical push notification, is the 10-second (or whatever you choose for your timer) lag.

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

Sidebar

Ask A Question

Stats

  • Questions 460k
  • Answers 460k
  • 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 Solution from Tony: var mydata = $("#grid").jqGrid('getGridParam','data'); May 15, 2026 at 11:43 pm
  • Editorial Team
    Editorial Team added an answer I'm going to assume you mean automated testing. My interpretation… May 15, 2026 at 11:43 pm
  • Editorial Team
    Editorial Team added an answer Saurabh and Dan both have good posts on debugging 'Not… May 15, 2026 at 11:43 pm

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.