Quantcast
Channel: Topic Tag: MySQL | WordPress.org
Viewing all articles
Browse latest Browse all 5527

griffgj on "get_var email address query error"

$
0
0

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 "foo@bar.com". 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.

[No bumping - especially after only 1 hour. If it's that urgent, consider hiring someone.]


Viewing all articles
Browse latest Browse all 5527

Trending Articles