I feel like I’m going crazy, but it’s definitely a WordPress issue. I am trying to get the ID of the user from the database (the user is not logged in yet). If given the following query:
$print_user_id = $wpdb->get_var("SELECT ID FROM $wpdb->users WHERE user_login = '$user_login_email'"); echo $print_user_id;
Where $user_login_email = something like “firstname.lastname@example.org”. When I run this, it spits out nothing. If the user_login is not an email address, it works fine, but if it is, no dice. I’ve created another PHP file and run it manually outside of the WordPress environment and it works fine. I played around with different quotes, etc, to no avail. Am I missing something? Thank you for your help in advance.
- The topic ‘get_var email address query error’ is closed to new replies.