Jump to content

php mysql BETWEEN FUNCTION QUERY??


antonyfal

Recommended Posts

Hi,

Doing a Query SELECT * FROM table WHERE field BETWEEN low_number AND high_number

 

If i have three rows with three numbers: IE: 27, 50, 80.

and i run the query above, it returns a result of:

27 and 50.

 

How can i get it to return a result of:

27,50, and 80.??

 

WHY:

age range search: i want to return an age range of people = and between the age of say: 20 and 70 but i want to include the 20 and 70.

How can i do this?

 

Link to comment
Share on other sites

Unless a person is dead, their age is not a constant number. It changes once a year on their birthday.

 

You need to store the date of birth and then to find age ranges, perform a date comparison that corresponds to the correct birthday date range calculated relative to the current date.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.