if($_POST["type"] == "checkEmail")
{
$sql = "SELECT * FROM `user` WHERE user_email=:email";
$statement = $mysql->prepare($sql);
$email = $mysql->quote($_POST["email"]);
$statement->execute(Array(":email"=>$email));
$re = $statement->fetchAll();
if(1)
print_r(json_encode($re));//echo json_encode("Sorry,Some has tood that good e-mail:<");
else
print_r(json_encode($re));
}
I tried to use query function and it worked! But the prepare function didn't work!
Don't use ->quote(), ->prepare() is doing it already.
if($_POST["type"] == "checkEmail")
{
$sql = "SELECT * FROM `user` WHERE user_email=:email";
$statement = $mysql->prepare($sql);
$email = $_POST["email"];
$statement->execute(Array(":email"=>$email));
$re = $statement->fetchAll();
if(1)
print_r(json_encode($re));//echo json_encode("Sorry,Some has tood that good e-mail:<");
else
print_r(json_encode($re));
}
If this is not the problem, then you should probably post the error you're getting:
if($statement->execute(Array(":email" => $email))) {
// your code
} else {
print_r(json_encode($statement->errorInfo());
}