从datebirth sql字段计算年龄[复制]

Possible Duplicate:
Calculate Age in MySQL (InnoDb)

I have created a table and one of its columns is 'dob' (date of birth). It entered the birth date in the table in 0000-00-00 format. But I need to display my users ($id) with their age instead of the 0000-00-00 format.

My current page is displaying the info from my database in this format. It will display the age of different users.

<td align="center"><? echo $rows['age']; ?></td>

Here is a SQL query you can use.

SELECT EXTRACT(YEAR FROM (FROM_DAYS(DATEDIFF(NOW(), '1982-01-01')))) AS age