I am making a WordPress plugin. I have to create a Name and email checker.
i have a form with POST method. In this form you fill your email and name
<form method="post"> <input type="text" name="yourname" placeholder="name" required> <input type="text" name="mail" placeholder="email" required> <input class="btnAdd" type="submit" value="Add"> </form>
Then i want to make a sql query to check if there is a user with the email that has been filled in. i console.log’d $EmailCheckResults from below here. and it gives this back:
SELECT user_email FROM users WHERE user_email = 0
global $wpdb; $emailToCheck = $_POST['mail']; $EmailCheckResults = $wpdb->prepare("SELECT user_email FROM users WHERE user_email = %d", $emailToCheck); $CheckResults = $wpdb->get_var($EmailCheckResults);
any ideas why %d is 0? even if i fill in the email input
According documentation %d mean – digit placeholder. Use %s for strings.