Invalid Username Issue

in function get_userdatabyloging

*in function get_userdatabylogin

if ( !$user = $wpdb->get_row($wpdb->prepare(“SELECT ID, LOWER( user_login ) as user_login, user_pass, user_nicename, user_email, user_url, user_registered, user_activation_key, user_status, display_name, spam, deleted FROM $wpdb->users WHERE user_login = %s”, $user_login)) ){

is failing

when looking for admin

the query it’s running is SELECT ID, LOWER( user_login ) as user_login, user_pass, user_nicename, user_email, user_url, user_registered, user_activation_key, user_status, display_name, spam, deleted FROM wp_users WHERE user_login = ‘admin’

Anyone know how I can correct this so I stop having every user get an Invalid username when trying to login?