year only!
Posted: Tue Jan 21, 2003 4:21 am
i have an sql querry that tells the database to fetch from the field NATDAT which contains the bdays, all who have their bdays today (current day). my querry is like this:
the result now looks like this: eg.
Paul Hayes
Robert Andrews
etc...
i want it to be:e.g.
Paul Hayes - 1972
Robert Andrews - 1967
or
Paul Hayes - '72
Robert Andrews - '67
then i echo it this way:$result = mysql_query ("SELECT * FROM mytable
WHERE substring(NATDAT,6) = substring(curdate(),6)
ORDER BY CNOMEN ASC, NOMRL
",$conn);
so it prints NOMRL which is the name and CNOMEN which is the surname. what i want to add after the CNOMEN is the year from the NATDAT field which contains the bday field in this format eg. 1972-01-21. i tried using substr in several ways but no luck! any help?echo "<table bgcolor=#FFFEEF border=0 cellpadding=1 cellspacing=0 style=border-collapse: collapse bordercolor=#111111 width=100%>";
echo "<font face=Verdana size=1 color=#800000><li>{$row['NOMRL']} </b> {$row['CNOMEN']}</font></li></table>";
the result now looks like this: eg.
Paul Hayes
Robert Andrews
etc...
i want it to be:e.g.
Paul Hayes - 1972
Robert Andrews - 1967
or
Paul Hayes - '72
Robert Andrews - '67