query statement containing variable won’t execute

You’re not using prepare correctly, refer to the codex for an example.

$wpdb->get_var(
    $wpdb->prepare( 
        "
        SELECT meta_value FROM table
        WHERE user_id = %d
        AND meta_key = 'shipping_state'
        ",
        $need
    )
);

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