String variable in SQL query within WordPress getting an error when not using single quotes
This code is in a custom WordPress plugin. if (isset($_POST['send_user'])) { $username = sanitize_text_field( $_POST['username'] ); global $wpdb; $customer_id = $wpdb->get_var("SELECT user_id FROM wp_wc_customer_lookup WHERE username = $username"); This code does not work properly and it gets an error message…