Reloading a php file?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Admin

    Reloading a php file?

    Ok, fairly new to php but I am learning. This may be an easy question
    but here it goes anyway.

    I have a website that is built on php/mysql. My members can send and
    get email and instant messages. The problem is for the member to get an
    alert that they have a "new message" the page must be reloaded.
    Obviously this is a bandwidth kill, plus if the user dosen't pay
    attention or view any other pages they will never get an alert.

    Does anyone know of a way I can do this in php without reloading the
    whole page? In an iframe maybe?

    Any help would be greatly appreciated.

  • f3l_

    #2
    Re: Reloading a php file?

    do it the easy way, with a reloading iframe and META stuff, or the hard
    way, with XMLhttprequest, setTimeout, and Javascript.

    either way, you r in for one hell of a ride!



    /f3L

    Comment

    • Chung Leong

      #3
      Re: Reloading a php file?

      It's one of those times when AJAX is a sensible solution. Use the
      setInterval() function to poll the server every now and then. One thing
      to remember is to set up Apache so that it'd exclude the polling script
      from the server log. Otherwise it'd grow very rapidly.

      Comment

      • Admin

        #4
        Re: Reloading a php file?

        Do you have an example of this or know where you can point me to see an
        example?

        Comment

        • Jeff Johns

          #5
          Re: Reloading a php file?

          AJAX Tutorial:


          Old JS Guide (Good Start):


          setTimeout:


          Comment

          • Admin

            #6
            Re: Reloading a php file?

            Hell ride is more like it. I see that ajax could do the job but it
            looks like a complicated way to do it. How would I do it with iframes
            and a meta refresh. Keep in mind that I have to pass session
            information.

            Comment

            Working...