How to insert a variable into a query parameter?

Errr, are you talking about this:

$variable = get_field('loop_category');
$args = array(
    'category_name' => $variable,
);
$catquery = new WP_Query($args);
while ($catquery->have_posts()) {
    $catquery->the_post();

    // Do your thing

}

If so, this is basic PHP and has nothing to do with WordPress – even though this is used in its context.

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