php-general | 2005051
Date: 05/09/05
- Next message: andreja <email protected>: "Re: [PHP] Between Query (0T)"
- Previous message: Mark Rees: "RE: [PHP] need manual reload on Mac client"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 5/9/2005 9:47:50 AM, Burhan Khalid (phplist <email protected>) wrote:
> Ryan A wrote:
>
> > <clip>
>
> > Your looking at something like. For ages between 21 and 23
>
> >
>
> > $Upper = date("m-d-Y", mktime(0,0,0,date("m"),date("d"),date("y")-22));
>
> > $Lower = date("m-d-Y", mktime(0,0,0,date("m"),date("d"),date("y")-23));
>
> >
>
> > $sql =
> "SELECT field1,field2,field3 FROM `table_name` WHERE `age`
> > BETWEEN " .
> $Lower . " AND " . $Upper;
>
> >
>
> > $result = myqsl_query($sql);
>
> >
>
> > etc....
>
> >
>
> > Cheers
>
> > Richard
>
> > </clip>
>
> If you are lucky enough to use MySQL 5 *grin* you can simply do :
>
> SELECT field1,field2 FROM `sometable` WHERE
> TIMESTAMPDIFF(YEAR,NOW(),`age`) = 22
>
> to find all 22 year olds.
Hey,
Luck and me? You dont know who you are talking to my friend....I am still on
mysql 3.23 not even
4.1 !!!
:-D
Cheers,
Ryan
-- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.11.6 - Release Date: 5/6/2005-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
- Next message: andreja <email protected>: "Re: [PHP] Between Query (0T)"
- Previous message: Mark Rees: "RE: [PHP] need manual reload on Mac client"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

