$mail = $_POST['mail'];
$mail = htmlspecialchars($mail);
$mail = urldecode($mail);
$mail = trim($mail);
$info_user = mysqli_fetch_assoc($link->query("SELECT * FROM `user` WHERE mail = $mail"));
if($info_user) {
echo '1';
}
else {
echo '2';
}
$mail = $_POST['mail'];
$mail = trim($mail);
$mail = $link->real_escape_string($mail);
$info_user = mysqli_fetch_assoc($link->query("SELECT * FROM `user` WHERE mail = $mail"));
if($info_user) {
echo '1';
}
else {
echo '2';
}
$mail = $_POST['mail'];
$mail = trim($mail);
$stmt = $link->prepare("SELECT * FROM user WHERE mail = ?");
$stmt->bind_param("s", $mail); // here we can use only a variable
$stmt->execute();
$result = $stmt->get_result();
$info_user = $result->fetch_all(MYSQLI_ASSOC);
if($info_user) {
echo '1';
}
else {
echo '2';
}