Menu order of parent menu from perspective of child menu

I solved it using ‘menu_order’:

function parent_menu_order($post) {
   if( isset($post->post_parent) ) {
      if($post->post_parent == 0) {
         return $post->menu_order;
      }// if no parent,  return it itself
      $post_data = get_post($post->post_parent);
      return $post_data->menu_order;
   } else {
      return -1;
   }
}

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