SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    We like music. weirdbeardmt's Avatar
    Join Date
    May 2001
    Location
    Channel Islands Girth: Footlong
    Posts
    5,882
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Automatically generate email on a timer

    Hi

    Is it possible for a webpage to once a week automatically perform an SQL query and then email the results to me?

    I am using PHP and MySQL.

    Thanks
    I swear to drunk I'm not God.
    Matt's debating is not a crime
    Hint: Don't buy a stupid dwarf Clicky

  2. #2
    Wibblesticks Gryff's Avatar
    Join Date
    Oct 2001
    Location
    Asgard
    Posts
    442
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    this would be a nice idea
    anyone got any clues?

  3. #3
    SitePoint Addict
    Join Date
    Sep 2000
    Location
    Ontario, Canada
    Posts
    320
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This would be a job for CRON.

    This thread might give you a head start:

    http://www.sitepointforums.com/showt...highlight=cron
    Jason Dulberg
    Extreme MTB
    http://extreme.nas.net

  4. #4
    We like music. weirdbeardmt's Avatar
    Join Date
    May 2001
    Location
    Channel Islands Girth: Footlong
    Posts
    5,882
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by jdulberg
    This would be a job for CRON.

    This thread might give you a head start:

    http://www.sitepointforums.com/showt...highlight=cron
    Thanks for that.
    I swear to drunk I'm not God.
    Matt's debating is not a crime
    Hint: Don't buy a stupid dwarf Clicky

  5. #5
    We like music. weirdbeardmt's Avatar
    Join Date
    May 2001
    Location
    Channel Islands Girth: Footlong
    Posts
    5,882
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I had a good read of that thread. And checked my control panel with my host and it offers crontab.

    Well. Could someone explain how cron works cos I am still confused.

    Basically I want a page to perform a query on a database once a week then email the results to me. How could I do this, using cron?
    I swear to drunk I'm not God.
    Matt's debating is not a crime
    Hint: Don't buy a stupid dwarf Clicky

  6. #6
    SitePoint Addict
    Join Date
    Sep 2000
    Location
    Ontario, Canada
    Posts
    320
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Basically, you would just created a file that does your sql query and email -- then set up your crontab to run that file at the specified time/date.
    Jason Dulberg
    Extreme MTB
    http://extreme.nas.net

  7. #7
    We like music. weirdbeardmt's Avatar
    Join Date
    May 2001
    Location
    Channel Islands Girth: Footlong
    Posts
    5,882
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by jdulberg
    Basically, you would just created a file that does your sql query and email -- then set up your crontab to run that file at the specified time/date.
    it didn't appear to offer weekly as an option!?
    I swear to drunk I'm not God.
    Matt's debating is not a crime
    Hint: Don't buy a stupid dwarf Clicky

  8. #8
    SitePoint Addict
    Join Date
    Sep 2000
    Location
    Ontario, Canada
    Posts
    320
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can set it to run on particular days of the week - so maybe set it to run at 12am every Sunday

    0 0 * * 0 /path/to/file.php

    Here's a nice little article that explains various CRON features:

    http://www.codingclick.com/article.php/aid/17
    Jason Dulberg
    Extreme MTB
    http://extreme.nas.net


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
  •