Re: Between Query (0T)
| From: | Ryan A | Date: | Sun, 08 May 2005 15:01:42 +0000 |
| Subject: | Re: Between Query (0T) | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-214702@lists.php.net to get a copy of this message | ||
Hey,
Thanks for replying.
> SELECT * FROM
>
table
> WHERE age BETWEEN 25 AND 26;
I knew the above, but how do i use it with my date field when i have
birthdates like this:
01-01-1969
and 03-05-1955
Thanks,
Ryan
On 5/8/2005 4:28:44 PM, Andy Pieters (mailings@vlaamse-kern.com) wrote:
> On Sunday 08 May 2005 15:20, Ryan A wrote:
>
> > Hi,
>
> > Sorry I know this is OT but I'm hoping someone will still help...it
should
> > be quite simple :-)
> > I have a field in the database called "age" which is a DATE field.
> >
> > I also have a webform where the user can select between which ages he
wants
> > the records shown...
> > eg: if he types 23,25 then I should get all results where
> > age >=23 and age <=25
> >
> SELECT * FROM
> table
> WHERE age BETWEEN 25 AND 26;
>
> You might want to sanitize your input first.
>
> Like using intval() on your input or mysql_escape_string
>
>
> Regards
>
>
> Andy
>
> > Thanks,
> > 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
>
> --
> Registered Linux User Number 379093
> -- --BEGIN GEEK CODE BLOCK-----
> Version: 3.1
> GAT/O/>E$ d-(---)>+ s:(+)>: a--(-)>? C++++$(+++) UL++++>
--
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