Assigning WP functions which echo to PHP variables

Found it, I think this was suggested to me in another answer.

$output .= ...

ob_start();
settings_fields('my_settings');
do_settings_sections('my_settings');
$output .= ob_get_clean();

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