You are here: Re: What's wrong with this? « PHP SQL « IT news, forums, messages
Re: What's wrong with this?

Posted by Virginner on 10/12/07 00:13

"Mad Hatter" <colin@class31.co.uk> wrote in message
news:emsz5m7dx3wa$.1sbfzo9srgret.dlg@40tude.net...
>I need to find out whos birthdays land today. The DOB is stored in a
> standard Unix timestamp. I'm trying to use the following but it throws up
> a
> syntax error.
>
> SELECT numberx FROM member WHERE date('d m',dob)=date('d m',time())
>
> Where am I going wrong?

DATE() does not take any parameters - you're getting confused with PHP's
date, or SQL's DATE_FORMAT
TIME() only returns the time of day

Are you sure you have the dob as a Unix Timestamp? That would be weird.
Now for example would be "1192147732" in Unix Time.

It's more likely you have the dob as a DATE column-type, e.g. 1943-12-31

It that's the case, then use:

SELECT numberx FROM member WHERE DAYOFYEAR(dob)=DAYOFYEAR(NOW())

Have fun.

 

Navigation:

[Reply to this 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

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