Use slug rather than id for $post->post_parent?

You can also get slug from direct post parent id like:

$parent_id   = $post->post_parent;
$post_parent_slug = get_post_field( 'post_name', $parent_id );

Now you can replace:

'2' == $post->post_parent

to

'notes' == $post_parent_slug

Try this.

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