dadamssg Posted April 15, 2009 Share Posted April 15, 2009 i store information about my users in my db. They have the option to give me their first and last name, birthday, male/female, etc. This is all updated by the user in ONE form. By default my date selection list for their birthday is set to Jan 1 2009(the current year). So if they don't want to enter their real birthday that date gets stored automatically. SOO in order to grab useful information i want to grab all the information where their dob is greater than 13 years. how would i use mysql to accomplish this Select query? or does anyone have a better method to not get bs birthdays? Quote Link to comment https://forums.phpfreaks.com/topic/154221-select-older-than-13/ Share on other sites More sharing options...
rhodesa Posted April 15, 2009 Share Posted April 15, 2009 how exactly is the date stored in the table? separate fields? DATE datatype? timestamp in an INT? easiest thing to do is post the code for the CREATE TABLE statement Quote Link to comment https://forums.phpfreaks.com/topic/154221-select-older-than-13/#findComment-810789 Share on other sites More sharing options...
dadamssg Posted April 15, 2009 Author Share Posted April 15, 2009 Their date of birth is stored in a datetime column. Quote Link to comment https://forums.phpfreaks.com/topic/154221-select-older-than-13/#findComment-810799 Share on other sites More sharing options...
mandred Posted April 15, 2009 Share Posted April 15, 2009 INTERVAL 13 YEAR Quote Link to comment https://forums.phpfreaks.com/topic/154221-select-older-than-13/#findComment-810807 Share on other sites More sharing options...
dadamssg Posted April 15, 2009 Author Share Posted April 15, 2009 how do i use that to grab dates equal to or greater than 13 years from their birthday? Quote Link to comment https://forums.phpfreaks.com/topic/154221-select-older-than-13/#findComment-810810 Share on other sites More sharing options...
rhodesa Posted April 15, 2009 Share Posted April 15, 2009 try SELECT * FROM tbl_name WHERE date_col < DATE_SUB(CURDATE(),INTERVAL 13 YEAR) Quote Link to comment https://forums.phpfreaks.com/topic/154221-select-older-than-13/#findComment-810813 Share on other sites More sharing options...
dadamssg Posted April 15, 2009 Author Share Posted April 15, 2009 thanks ill try it when i get back to my person computer Quote Link to comment https://forums.phpfreaks.com/topic/154221-select-older-than-13/#findComment-810820 Share on other sites More sharing options...
rhodesa Posted April 15, 2009 Share Posted April 15, 2009 thanks ill try it when i get back to my person computer you have a computer made from a person? that is awesome! Quote Link to comment https://forums.phpfreaks.com/topic/154221-select-older-than-13/#findComment-810873 Share on other sites More sharing options...
dadamssg Posted April 15, 2009 Author Share Posted April 15, 2009 haha yeah...programmed him myself... *PERSONAL* Quote Link to comment https://forums.phpfreaks.com/topic/154221-select-older-than-13/#findComment-810895 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.