How to use get_results() in widget front end?

It seems that you can’t access to it. Please try add global $wpdb; to your function.

UPDATE

For reference, in WordPress Codex you will find:

WordPress provides a global variable, $wpdb, which is an instantiation
of the class already set up to talk to the WordPress database. Always
use the global $wpdb variable. (Remember to globalize $wpdb before
using it in any custom functions.)