Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

PHP reoccuring jobs...


  • Please log in to reply
4 replies to this topic

#1 KamakaZ

KamakaZ

  • Members
  • 739 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Victoria
  • Local time:04:53 AM

Posted 01 October 2009 - 12:07 AM

I have a website that allows users to post jobs into a mySQL database and then pull results according to certain variables they set.

They have these same set jobs that reoccur every week and would like to 'click a button and enter them in'. So what i was thinking is create a form with the default values of the jobs required (this will allow them to remove/add jobs still) and have php get the date of monday-friday next week and enter them in on the days needed.

I've been modifying the following code to get the dates:
$tod=date("N")-2;
$mon=strtotime('+'.$tod.' days');
echo date('d M Y',$mon);

Problem being if they insert the jobs on a wednesday or thursday the date for friday will be this weeks date and not the following.

Any idea's on how i could go about resolving this as i am kind of in a pickle.

~ Kam

There's no place like 127.0.0.1
There are 10 types of people in the world, those that can read binary, and those who can't.


BC AdBot (Login to Remove)

 


#2 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:11:53 AM

Posted 01 October 2009 - 01:33 AM

So basically what you are asking is how to add a reoccurring event?

#3 KamakaZ

KamakaZ
  • Topic Starter

  • Members
  • 739 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Victoria
  • Local time:04:53 AM

Posted 01 October 2009 - 01:36 AM

exactly... on certain days though, so job 1 is always on monday, job 2 on tuesday etc... then they pull reports mainly based on dates.

There's no place like 127.0.0.1
There are 10 types of people in the world, those that can read binary, and those who can't.


#4 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:11:53 AM

Posted 01 October 2009 - 01:51 AM

A bazillion years ago, I created a checkbook application for a property management company. One of the functions was allowing the managers to mark a transaction as recurring. All I did was added a checkbox to the form that would allow the user to mark a transaction as recurring. The "mark" simply consisted of a flag in the database that when viewed ahead of the transaction date, simply showed up as a future transaction. That meant that when the checkbook registry was viewed, the database had to be polled for recurring transactions. In order to prevent an infinite number of future transactions from being visible, I programmatically limited the projected transactions to 24 months, and the transactions only showed up within 5 days of the transaction going through.

If you did not anticipate the need for this functionlaity, you are going to need to update the table to add an extra attribute (not on a live system) and test the functionality (again, not on a live system)

#5 KamakaZ

KamakaZ
  • Topic Starter

  • Members
  • 739 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Victoria
  • Local time:04:53 AM

Posted 01 October 2009 - 05:51 PM

I'm not sure that's what i am looking to do, i'm only looking to have the users input the same weekly jobs a week in advance. I think to be able to do this, i need a way of first getting today's date, finding out what day it is, then get the dates of next weeks monday-friday.

There's no place like 127.0.0.1
There are 10 types of people in the world, those that can read binary, and those who can't.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users