Identify that a page is a grandchild page

use get_page twice like this handy little function

function get_grandpapa($page_id){
    $current_page = get_page( $page_id );
    if ($current_page->post_parent > 0){
        //has at least a parent
        $parent_page = get_page($current_page->post_parent);
        if ($parent_page->post_parent > 0){
            return $parent_page->post_parent;
        }else{
            return false;
        }
    }
    return false;
}

This function returns the grandparent page ID or false if there is no grandparent.

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