I’m attempting to validate an enter field in opposition to a subject in a database. My query is, how does one test a single enter equal to any subject in a column? I’m able to connect with my question, however am unable to carry out the validation. Am I lacking one thing?
Right here is my code:
add_action('woocommerce_checkout_process', 'username_auth');
operate username_auth() {
world $wpdb;
// INPUT FIELD
$username = $_POST['custom_field_username'];
$user_login_sql = $wpdb->get_results("SELECT username, FROM registration_info WHERE username");
if(isset($username) && $username !== $user_login_sql) {
wc_add_notice(('Incorrect username123'), 'error');
}
}