If you are using MySQL (which I assume you are based on the $row variable), check out the datediff function.
That will give you the number of days between 2 dates. So you could do a statement like this to get the age.
SELECT (DATEDIFF(dog_dob, years) / 365) AS age ....
As for PHP, looks like your function will do what is needed, but it is probably overkill if you only want the years. Something like this would work. Basically determine the number of seconds between the dates, then divide by the number of seconds in a year.
$date_1 = $row_member_profile['dog_dob'];
$date_2 = $row_member_profile['years'];
$seconds = abs(strotime($date_1) - strotime($date_2));
$years = floor($seconds / (365 * 24 * 60 * 60));
I woud say the MySQL route is the easiest to do.