Help a newb?

Thread Solved

Join Date: Sep 2009
Posts: 3
Reputation: uktena is an unknown quantity at this point 
Solved Threads: 0
uktena uktena is offline Offline
Newbie Poster

Help a newb?

 
0
  #1
Sep 18th, 2009
I'm writing a utility for work using forms, then submitting the supplied information into a database with php. The work this intended for is to be performed every thirty days. I need to find a way to automatically check the database and be sure each table in this database has had an entry within the last 30 days or email me if not. Any help you all might give would be greatly appreciated.
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 1,072
Reputation: ardav will become famous soon enough ardav will become famous soon enough 
Solved Threads: 137
ardav's Avatar
ardav ardav is online now Online
Veteran Poster

Re: Help a newb?

 
-1
  #2
Sep 18th, 2009
If you want an automatic check, use CRON JOBS - see your host for this as they don't always supply this facility. Else, get a script to email you every time the db is updated. If it's just a simple mail, the php mail() function should be fine.

If the db is updated a number of times every month, the emails will become tedious, so I would use CRON JOBS in this case. You'll still need to write a script for the cron job. Something like:

[your php script]
1. check the tables for the latest entry/update
2. use the php date function and the mysql date_format function to just check the numerical month or something more sophisticated (e.g. last 30 days)
3. if no records are returned for a table, note it.
4. collate the info and mail it via mail().

If you produce a script I'll have a look at it and advise further.
Happy Humbugging Christmas
Reply With Quote Quick reply to this message  
Join Date: Sep 2009
Posts: 62
Reputation: kylegetson is an unknown quantity at this point 
Solved Threads: 9
kylegetson's Avatar
kylegetson kylegetson is offline Offline
Junior Poster in Training

Re: Help a newb?

 
0
  #3
Sep 19th, 2009
yea, definately a cron job would be your best bet. If youre hosting on a cPanel server, you can do this without going to the command line. If not, and you'll either need to get your host to set up the job for you, or if you have ssh, you can create the cron job yourself.
Reply With Quote Quick reply to this message  
Join Date: Sep 2009
Posts: 3
Reputation: uktena is an unknown quantity at this point 
Solved Threads: 0
uktena uktena is offline Offline
Newbie Poster

Re: Help a newb?

 
0
  #4
Sep 28th, 2009
Still stuck here. I understand how to make most of this work, and yes thankfully I do have Cron. The part that's getting me is this, each of my tables have a field for timestamp. I can search and pull the most recently timestamped record. However, finding a way to have my script compare this timestamp with the current time and date is the problem.
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 1,072
Reputation: ardav will become famous soon enough ardav will become famous soon enough 
Solved Threads: 137
ardav's Avatar
ardav ardav is online now Online
Veteran Poster

Re: Help a newb?

 
-1
  #5
Sep 28th, 2009
Check out the INTERVAL keyword in the MySQL online manual.
Happy Humbugging Christmas
Reply With Quote Quick reply to this message  
Join Date: Sep 2009
Posts: 3
Reputation: uktena is an unknown quantity at this point 
Solved Threads: 0
uktena uktena is offline Offline
Newbie Poster

Re: Help a newb?

 
0
  #6
Sep 28th, 2009
Looks as though I got it working thanks for your help. The whole thing seems to be working perfectly, so far.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum
Thread Tools Search this Thread



Tag cloud for PHP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC