Set title of page using custom page template

For dog breeds, I added the following code to template pages, overwriting the WP SEO functions:

function assignPageTitle() { // To set page title
    global $resultarray;
    return $resultarray->breed_title;
} 

if ( uri_segment( 2 ) != '0' ) {
    add_filter( 'wpseo_title', 'assignPageTitle' ); // WP SEO function overwritten
}

For a list of other WP SEO functions, see this.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)