1

I have a simple mysql query which shows users last status. I now want to go further and create a page to show users most recent status without refreshing. The mysql DB is dynamically updated with the users status.

So all that is required is for the page rendering the mysql to refresh with the latest user status without me having to hit the refresh button.

Could anyone provide guidance on how I go about doing this. Thanks

6
  • and your question is...? Commented Nov 20, 2012 at 17:36
  • You'd need to use some form of Ajax (or nodes) to poll for data and then insert it into the page with Javascript. Commented Nov 20, 2012 at 17:42
  • w3schools.com/js/js_timing.asp Commented Nov 20, 2012 at 17:43
  • Hey Ben could you please elaborate? Commented Nov 20, 2012 at 17:44
  • 2
    @ethrbunny: w3fools Commented Nov 20, 2012 at 17:45

1 Answer 1

1

You need push into page, not pool. It is kind of stupid to do poling from database. Here is how that works.

  1. Let asume that you have n users on you page.
  2. Every time that status is changed (you insert that into you DB)

    2.1 As this happens you need to push signal to your webpage (use Strophe library).

    2.2 In order to push something to page you need Strophe instance running.

    2.3 If your website is PHP, here is good class for communicating with Strophe instance.

    I can do this for your but you will be more happy if you do this on your own. That real time stuff are very interesting.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.