Jump to content

Recommended Posts

Hi guys,

 

My apologies if this is in the wrong forum but I am not really sure how to go about this.

 

I have not written any code for this but I have four fields in one table one called age and 3 others dobmonth / dobday /dobyear -

 

My question being how would I write some code that automatically fills in the age field based on the date of birth fields?

 

If anyone could point me in the right direction that would be awesome,

 

Appreciated.

Link to comment
https://forums.phpfreaks.com/topic/258839-age-date-of-birth/
Share on other sites

I was using a date before but does it not require users to use dd/mm/yyyy ? I now have 3 selects which nicely lets user select the month day and year, is this possible to put into one date field? if so enlighten me!

 

Back to the main question my age field at the moment is in the same table as the dob fields and it is an int. - or is this not what you meant?

 

to floridaflatlander

 

Is this tutorial about this certain question or similar? if so I will have a look

 

Thanks for the help so far guys!

Link to comment
https://forums.phpfreaks.com/topic/258839-age-date-of-birth/#findComment-1326900
Share on other sites

Thanks a lot for the timediff() I think that will help, and it makes sense to store the 3 selects into one variable and to send that through to the server, thanks for the input!

 

to robertP

 

I keep reading over the code you wrote and understand it considerably but would it be able for you to explain me how to use that in action?

 

Appreciated

Link to comment
https://forums.phpfreaks.com/topic/258839-age-date-of-birth/#findComment-1326943
Share on other sites

You can concatenate the month, day, year and separators to create a variable to insert into your table date field. Then you can use http://www.zoomcities.com/forum/showthread.php?tid=5728

 

I have now concatenated the 3 fields into one variable which goes into a date field (dob)

Link to comment
https://forums.phpfreaks.com/topic/258839-age-date-of-birth/#findComment-1327069
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.