0

If I want to search record by age like (30 to 35) just like dating script but I will not use in dating site, I have my school website and I just want to display record by age but If I want to display age between 14 to 17 kindly let me know what should I do?
Thanks in advance

3
Contributors
4
Replies
5
Views
7 Years
Discussion Span
Last Post by drjohn
0

Hehe
what school you attend selecting from age range 30 to 35? After all you are still programming for hidden dating site, isn't it?

Why not writing a simple query as for example:

select all_my_dating from mytables where YEAR(CURDATE()-DOB) between 30 and 35;

Hint: Never store age of a person in database, except you are planing kind of provision of work ;)

-- tesu

0

Thanks for your reply, as I told before I am new and I just want to make school website. I just want to display student record by age 12 to 18. In my database I didn't used Date of birth I use age column.

1

Aha age columns. That makes the query tremendously simpler:

SELECT all_my_dating FROM mytables WHERE age BETWEEN 30 AND 35;

... BUT: where keeps the DOB file? And will those ages be manually updated in database just before or just after pupil's birthday partys every year?

-- tesu

Edited by tesuji: n/a

0

In simple terms, age is a calculated value, which will change with time. So NEVER store it, calculate it, as shown in the first answer given. Then it will always be the correct age.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.