Guys, good morning!
I'm in trouble and need your help. My situation is as follows:
In the onclick of a form button, I call a function called register (below code)
function register(){
$.post("register.php",{usu_email : $("#register_usu_email").val()}, function(data) {
if(data === 'yes'){
...
}else{
...
}
});
};
The goal is to verify if the email is already registered in the database, if so, returns a 'yes', and do a script for error.
Within my register.php I check as follows below. My problem is that the register function, the if (data === 'liked') is never true, as much as my user has already registered in the database, if I take a alert (date) it shows to me 'yes', but if I put it in a condition, it is never true. How do I treat a correct return in this situation?
<?php
include 'conexao/conexao.php';
$usu_email = $_POST['usu_email'];
$sql = "select * from usuario where usuario.usu_email = '$usu_email'";
$retorno = mysql_query($sql,$mysql);
echo "email";
if (mysql_num_rows($retorno) == 1){
echo "achou";
} else{
echo "nao achou";
}