Web Analytics Made Easy -
StatCounter PHP - Refresh / Flush - CodingForum

Announcement

Collapse
No announcement yet.

PHP - Refresh / Flush

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • PHP - Refresh / Flush

    I have an application that uses the meta refresh mode, however, having searched the net I can't seem to find anything that tells me whether I can refresh a page using PHP alone.

    I have 2 PHP pages one where the user can enter information which is written to a MySql database, the other that reads the database and displays the contents to the clients screen. At the moment the only way I can do this is by using a meta refresh every couple of seconds.

    I would ideally like to loop the second page and just display what I've read from the database so far. This would mean that the only time this page would complete is when the user closes the window.

    This is essentially a small chat application, that should give you a better idea of what I am trying to achieve.

  • #2
    colandy,

    I'm not sure I totally understand your problem.

    How many users are there using this php application?

    This would mean that the only time this page would complete is when the user closes the window.
    What do you mean by this exactly?

    FYI, PHP cannot refresh a page. It is a server-side script. In order to refresh a user's browser, you need to use some sort of client-side script, such as JavaScript or VBScript. These languages have events that you can code with (onChange...), and may help you recognize when a browser has closed. However, I don't think it's possible to inform every browser that is looking at your php page that some user has closed their browser.

    However, I may be wrong. But that's my best answer until you clarify a little better what it is you're wanting.

    Hope that helps,
    Sadiq.

    Comment


    • #3
      in my experience, chat applications are written using frames, and javascript or a meta-refresh refreshes the "chat" frame...

      If you want real-time, then you'll need to go with something like a java applet.

      Comment

      Working...
      X