Reply to Re: how might I accomplish this?

Your name:

Reply:


Posted by gerg on 12/19/05 10:42

Tyrone Slothrop wrote:
> On Sat, 17 Dec 2005 22:21:17 -0800, gerg <noemail@noemail.com> wrote:
>
>
>>I'm trying to create a site for my family and one of the features is
>>going to be a "birthday" reminder of upcoming birthdays. I'm having
>>each member register and in doing so enter their birthday in the
>>following format:
>>
>>04-21-1983 or 11-23-1976
>>
>>What I want to do is write a script that will check the database from
>>the current date, and then go out 30 days to check and see if any
>>birthdays lie in that range. I guess I'm just not sure what my query
>>should look like.
>>
>>So, taking today for instance, it's the 17th of Dec. I want to find out
>>if there are any birthdays between the 17th of Dec and the 16th of Jan.
>>Can anyone help me out with this?
>>
>>Thanks in advance.
>>
>>Greg
>
>
> In MySQL a date would be saved in the format yyyy-mm-dd and, if you
> stored the value in that format, the query would be like:
> SELECT * FROM table WHERE (birthdate >= CURRENT_DATE() OR birthdate <=
> DATE_ADD(CURRENT_DATE(),INTERVAL 30 DAY);

Tyrone, Thanks alot. I'm gonna give this a shot. So, the
current_date() function will look for the format of yyy-mm-dd ? I'm
actually inserting the birthdays in the mm-dd-yyyy format. Will this
make a difference? I'm assuming it will, so I will alter the script to
submit in the other format.

The INTERVAL 30 DAY, is specifying to look out 30 days? I'm assuming
changing this number will allow me to return different amount of days to
go out? It seems like the main thing to make this work is how I submit
the original birthday dates in the database. Thanks again tyrone!

Greg

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация