Im trying to check if the email exist in the ddbb, so my code is:
<?php
include 'connection.php';
$email=addslashes ($_POST['cEmail']);
$sqlEmail = "select cEmail from Client where cEmail = '$email'";
$exist = mysql_fetch_row($sqlEmail);
if (isset($_POST['submit']))
{
if($exist == false){
$name = addslashes ($_POST['cName']);
$surname=addslashes ($_POST['cSurname']);
$email=addslashes ($_POST['cEmail']);
$phone=addslashes ($_POST['cPhone']);
$otherPhone=addslashes($_POST['cOtherPhone']);
$languages=implode(' | ', $_POST['cLanguages']);
$address=addslashes ($_POST['cAddress']);
$neighborhood=addslashes ($_POST['cNeighborhood']);
$pswd=addslashes($_POST['cPswd']);
$service= addslashes ($_POST['cService']);
$sql = "INSERT INTO Client(cName, cSurname, cEmail, cPhone, cOtherPhone, cLanguages, cAddress, cNeighborhood, cPswd, cService)
VALUES ('$name', '$surname', '$email', $phone, $otherPhone, '$languages', '$address', '$neighborhood', '$pswd', '$service')";
if ($conn->query($sql) === TRUE) {
echo "New record created successfully";
}
}else{
echo "the email exists";
}
}
?>
So the problem becomes when the email address exist in the database, is not giving any message. Any ideas?
Thanks!