943,694 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Marked Solved
  • Views: 720
  • PHP RSS
Sep 18th, 2009
0

Help a newb?

Expand Post »
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.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
uktena is offline Offline
3 posts
since Sep 2009
Sep 18th, 2009
-1

Re: Help a newb?

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.
Sponsor
Featured Poster
Reputation Points: 1048
Solved Threads: 945
Sarcastic Poster
ardav is offline Offline
6,676 posts
since Oct 2006
Sep 19th, 2009
0

Re: Help a newb?

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.
Reputation Points: 26
Solved Threads: 12
Junior Poster in Training
kylegetson is offline Offline
89 posts
since Sep 2009
Sep 28th, 2009
0

Re: Help a newb?

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.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
uktena is offline Offline
3 posts
since Sep 2009
Sep 28th, 2009
-1

Re: Help a newb?

Check out the INTERVAL keyword in the MySQL online manual.
Sponsor
Featured Poster
Reputation Points: 1048
Solved Threads: 945
Sarcastic Poster
ardav is offline Offline
6,676 posts
since Oct 2006
Sep 28th, 2009
0

Re: Help a newb?

Looks as though I got it working thanks for your help. The whole thing seems to be working perfectly, so far.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
uktena is offline Offline
3 posts
since Sep 2009

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: Iframe and virus
Next Thread in PHP Forum Timeline: How to insert a date-time box





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC