the_widget() inside functions.php

The function the_widget() does not return any output it only echos it. If you want to save its output to a variable you need to use output buffering.

ob_start();
the_widget('My_Custom_Widget');
$w = ob_get_contents();
ob_end_clean();

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