| | |
Help a newb?
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: Sep 2009
Posts: 3
Reputation:
Solved Threads: 0
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.
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.
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
•
•
Join Date: Sep 2009
Posts: 3
Reputation:
Solved Threads: 0
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.
![]() |
Similar Threads
- newb here (Community Introductions)
- Life Of A Newb Programmer (Tech / IT Consultant Job Offers)
- Click here is a newb looking for some solution from you!! (Database Design)
- Newb!! (Community Introductions)
- Please help ! A newb needs help with apache ! (Linux Servers and Apache)
- Registry Cleaner (Windows NT / 2000 / XP)
- Going Wireless (Networking Hardware Configuration)
- Where to find screensavers 4 MotorolaT720? (Geeks' Lounge)
- Microsoft Releases Web Matrix (ASP.NET)
Other Threads in the PHP Forum
- Previous Thread: Iframe and virus
- Next Thread: How to insert a date-time box
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax apache api array beginner binary broken cakephp checkbox class cms code cron curl database date directory display download dynamic echo email encode error fcc file files folder form forms function functions google howtowriteathesis href htaccess html image include insert integration ip java javascript joomla limit link login loop mail menu methods mlm mod_rewrite multiple multipletables mysql oop open parse paypal pdf php problem provider query radio random recursion regex remote script search select server sessions sms soap source space speed sql structure syntax system table template tutorial update upload url validation validator variable video web xml youtube






