Database Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesDatabase Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old March 17th, 2003, 04:00 PM
alfienobel alfienobel is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 4 alfienobel User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Query To Get Yearly Update

I need to create a way to send an email requesting people to re-submit a questionnaire to my database exactly one year after they posted the original.
I need a way of automating this or at least flagging up entries that are over a year old.
I'm not sure how to set up the loop to compare the date_of_registration with the current date.
I'm using php with a mySQL database. The date_of_registration field is a 'date' datatype.
Any ideas would be gratefully received.

Alf

Reply With Quote
  #2  
Old March 17th, 2003, 06:39 PM
SeanGleeson SeanGleeson is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Wichita, Kansas, USA
Posts: 92 SeanGleeson User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via AIM to SeanGleeson Send a message via Yahoo to SeanGleeson
RE: Query To Get Yearly Update

Well, to get you started, here's how to select all the records that are a year or more old.

php Code:
Original - php Code
  1.  
  2. <?php
  3. // $db = mysql_connect goes here
  4. // mysql_select_db goes here
  5. $ayearago = "".(date("Y")-1)."-".date("m")."-".date("d");
  6. mysql_query("SELECT * FROM TableName WHERE date_of_registration <= '".$ayearago."'",$db);
  7. ?>

Once you've done a select, you can take it from there.

Reply With Quote
  #3  
Old March 17th, 2003, 06:56 PM
honcho's Avatar
honcho honcho is offline
Contributing User
Codewalkers Beginner (1000 - 1499 posts)
 
Join Date: Apr 2007
Location: Cape Cod
Posts: 1,347 honcho User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 52 m 2 sec
Reputation Power: 3
RE: Query To Get Yearly Update

You can also use:

SELECT * FROM TableName WHERE date_of_registration <= NOW() - INTERVAL 1 YEAR


Reply With Quote
  #4  
Old March 17th, 2003, 08:47 PM
SeanGleeson SeanGleeson is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Wichita, Kansas, USA
Posts: 92 SeanGleeson User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via AIM to SeanGleeson Send a message via Yahoo to SeanGleeson
RE: Query To Get Yearly Update

Well, sure, if you wanna do it the easy way. :rolleyes:

Reply With Quote
  #5  
Old March 27th, 2003, 01:57 PM
alfienobel alfienobel is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 4 alfienobel User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: Query To Get Yearly Update

Many thanks both of you. I'm just about to try them.......

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesDatabase Help > Query To Get Yearly Update


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway