I have the following SQL script:
$query = $wpdb->prepare(
"SELECT user_login FROM wpdb->staff as staff
join wpdb->users as users on staff.wp_user_id = users.ID
where full_name =%s",
$usernametest
);
$userlogin = $wpdb->query( $query );
But I am getting the following error:
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '->ab_staff as staff join wpdb->users as users on staff.wp_user_id = users.' at line 1