Calculate the age using data from my database

前端 未结 3 1503
执念已碎
执念已碎 2021-01-24 22:41

This is the code I\'m currently using, but it\'s not working. Geboortedatum means day of birth in Dutch.

mysql_connect(\'xxx\', \'xxx\', \'xxx\');

mysql_select_         


        
3条回答
  •  余生分开走
    2021-01-24 23:33

    This works fine,but your date should be in this format : mm/dd/yyyy

     date("md") ? ((date("Y")-$birthDate[2])-1):(date("Y")-$birthDate[2]));
             echo "Age is:".$age;
        ?>
    

    DEMO

提交回复
热议问题