How do I filter a custom post type loop by a field?

Something like this should work:

meta_key=hierarchy&meta_value=management

This should be added into the query_posts function, that is not shown in your code block, but should come before it.

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