Check every $i minutes?

Discussion in 'PHP' started by Shadow, Feb 22, 2006.

  1. #1
    I'm looking for a way to make a site update itself every $i minutes.

    Like a script that would check the number of threads at some forum but only every 60 minutes, not constantly, and then post it. Without the need to do it manually.

    I'm not looking for a finished script, just for a way to do it.

    Anyone :eek:
     
    Shadow, Feb 22, 2006 IP
  2. Lordo

    Lordo Well-Known Member

    Messages:
    2,082
    Likes Received:
    58
    Best Answers:
    0
    Trophy Points:
    190
    #2
    Cron jobs.
    1- Create your php script that does what you want without having to care about the $i minutes issue.
    2- From cpanel or shell, add a cron job for this file..
     
    Lordo, Feb 22, 2006 IP
  3. Shadow

    Shadow Peon

    Messages:
    191
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thank You, gonna search a bit for that.
     
    Shadow, Feb 22, 2006 IP
  4. itsall3

    itsall3 Active Member

    Messages:
    505
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    58
    #4
    Just wondering though mate? what do you want this code for?

    If its like a forum, like you say, people go into posts, click back, and if its a forum software, like vb or phpbb, it will update it then. So unless someone is going to sit for an hour, and not do anything, you wouldnt need it.

    If its somthing like ebay, and its a count down -- people keep hitting that F5 key every second! to make sure their page is up-to-date.

    The only real reason you'd need somthing that auto updates is like an rpg, but that would use a server, and run real time.

    Not been funny mate, i'd just like to know what your up to ;)

    Cheers.
     
    itsall3, Feb 22, 2006 IP
  5. Shadow

    Shadow Peon

    Messages:
    191
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #5
    A directory type of site which posts the position of the site in my directory. The regular thing actually, nothing special :p
     
    Shadow, Feb 25, 2006 IP
  6. mahmood

    mahmood Guest

    Messages:
    1,228
    Likes Received:
    43
    Best Answers:
    0
    Trophy Points:
    0
    #6
    I did something like this once. I wanted to display new rows of databse based of the time.

    Say we start from 1 Jan 2006 and now is 30 Jan 2006 and $i is 24 hours. So when the page loads end users see 30 rows of the database. If it is 60 days passed the start day they see 60 rows and so on.

    To do something like these you should study time and date functions in PHP.

    .
     
    mahmood, Feb 25, 2006 IP
  7. Shadow

    Shadow Peon

    Messages:
    191
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Yep, that is pretty much the same thing I was planning to do (and probably will), but this does a check every time someone displays the page. That is something I wanted to avoid.

    Thanks for your replies guys, the cron thing won't do cause my host is ...hmmm... different ;) Talked to him and well, he's not really comfortable with it. He's a good buddy of mine so well, it's his host.
     
    Shadow, Feb 25, 2006 IP
  8. Lordo

    Lordo Well-Known Member

    Messages:
    2,082
    Likes Received:
    58
    Best Answers:
    0
    Trophy Points:
    190
    #8
    lol
    OK so what options do you think you have? Or have you dumped the idea?
     
    Lordo, Feb 25, 2006 IP
  9. Shadow

    Shadow Peon

    Messages:
    191
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #9
    The easy way would be to check the values everytime the image showing the position is being loaded. Pretty straight forward.

    If I have dropped the idea? Well, I was just thinking about it, thinking how I'd do it :eek:
     
    Shadow, Feb 26, 2006 IP
  10. tccoder

    tccoder Peon

    Messages:
    69
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #10
    Create a cron job
     
    tccoder, Mar 7, 2006 IP