Add ACF field in a query

the_field is used to output, get_field is used to return.
So instead of

$category1 = the_field('category1');

It should be

$category1 = get_field('category1');

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