I have mysql database and contains table "act" which have 4 fields name
id, name, date_birth, date_of_retire
1 Jam 03-09-1987
2 Johnson 04-01-1992
I want to set a query for 'date_of_retire' as that it adds 60 years with 'date_birth' and display in
'date_of_retire' field.
please help.
Adil
Help in mysql?
Moderator: General Moderators
Re: Help in mysql?
An easy way would be to substr that baby.
Code: Select all
// fetch data
$date_birth = '03-09-1987'
$year = substr($date_birth, -4);
$year += 60;
$date_birth = substr($date_birth, 6). $year;
// insert data-
adilmarwat2004
- Forum Commoner
- Posts: 44
- Joined: Fri Sep 04, 2009 11:28 pm
Re: Help in mysql?
Dear!
I just want to set the query in mysql not in php.
I just want to set the query in mysql not in php.
Re: Help in mysql?
Aha missed that.
Well MySQL have similar functions, check out the documentation.
Well MySQL have similar functions, check out the documentation.