I was working on my website and stuck there. My current code is here:
$sql=mysql_query("SELECT id,name,birthday FROM users");
$data=array();
while($row = mysql_fetch_assoc($sql)){
$data[]=$row;
}
echo json_encode($data);
What I trying is before echoing json data I need to modify birthday value in the array to age using a function.
In my database birthday format is (1987-09-25)
And I want to convert it to age format(24) before json output.
Any help will be appreciated.
Thanks in advance..
You would do something like this.