1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
<?php
$req= mysql_query("SELECT sexe,date_naissance FROM utilisateur WHERE pseudo='" . mysql_real_escape_string($_SESSION['login']) . "'");
$repo=mysql_fetch_array($req);
echo '
<BR><FONT COLOR=RED>SEXE:</FONT>'.$repo['sexe'];
echo'<BR><FONT COLOR=RED>DATE DE NAISSANCE:</FONT COLOR>'.$repo['date_naissance'];
//calcule de l'age
$date_naiss=$repo['date_naissance'];
function Age($date_naissance)
{
$arr1 = explode('/', $date_naissance);
$arr2 = explode('/', date('d/m/Y'));
if(($arr1[1] < $arr2[1]) || (($arr1[1] == $arr2[1]) && ($arr1[0] <= $arr2[0])))
return $arr2[2] - $arr1[2];
return $arr2[2] - $arr1[2] - 1;
}
$age=Age($date_naiss); echo '('.$age.'ans).';?> |
Partager