Related “custom post type” using “custom taxonomy”

Assuming that you are on a taxonomy or term page then you can simply use:

//get current term
$term_slug = get_query_var( 'term' );
//get current taxonomy
$taxonomyName = get_query_var( 'taxonomy' );
$loop = new WP_Query( array(
    'post_type' => 'work', 
    'posts_per_page' => 10, 
    'orderby' => 'ASC',
    $taxonomyName => $term_slug); 
while ( $loop->have_posts() ) : $loop->the_post(); 

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