WordPress database error – Error in SQL syntax – I can’t identify any error?

You want the query to look like this: SELECT email FROM wp_my_users WHERE email=”[email protected]” instead of this: SELECT email FROM ‘wp_my_users’ WHERE email=”[email protected]” So try to construct your query with: $sql = “SELECT email FROM {$my_table_name} WHERE email = %s”; $result = $wpdb->get_var( $wpdb->prepare( $sql, $email_address ) ); where you don’t need to escape the … Read more