SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Enthusiast
    Join Date
    Sep 2002
    Posts
    26
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Can you setInterval in PHP?

    There is a function in javascript which allows you to repeatedly call another function at set time intervals i.e.
    setInterval("getthedate()",1000);

    this is very useful for clocks for example!

    Is there an equivalent function in PHP??

    Best regards, Brian

  2. #2
    ********* wombat firepages's Avatar
    Join Date
    Jul 2000
    Location
    Perth Australia
    Posts
    1,717
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    sleep() , but not really going to have the same uses serverside as javascript clientside ()
    (though you can stream stuff I suppose with it?)

    (php-gtk has timeouts etc ala javascript for clientside stuff)

  3. #3
    SitePoint Enthusiast
    Join Date
    Sep 2002
    Posts
    26
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hmmm... thanks for the feedback.

    What I am trying to do is read the contents of a counter file and display it in a frame so that it updates in real time (well every minute say) as a database file in appended to.

    Perhaps there is a better way to do this??

  4. #4
    Mlle. Ledoyen silver trophy seanf's Avatar
    Join Date
    Jan 2001
    Location
    UK
    Posts
    7,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just refresh the page that loads and displays the count

    Sean
    Harry Potter

    -- You lived inside my world so softly
    -- Protected only by the kindness of your nature

  5. #5
    SitePoint Enthusiast
    Join Date
    Sep 2002
    Posts
    26
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by seanf
    Just refresh the page that loads and displays the count

    Sean
    Yeah, that s a quick and dirty way to do it - just looking for something more elegant...

  6. #6
    Happy Holidays !! Paul S's Avatar
    Join Date
    Mar 2001
    Location
    Mexico
    Posts
    1,287
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    there's no more elegant way, IMO you need a combination of javascript and php (some hmlt tags could help you as well)

    Paul

  7. #7
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Could use a META refresh too, which would actually make more sense for something like this than using a javascript reload()
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev





Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •