Next. I am doing a validation with angular and php, for when a user is registered, be verified if such user and password already exist and is not registered again. I need the php to return some information to angular so that a message can be displayed if there is a user with the same data.
My php:
<?php
ini_set('display_errors', true);
error_reporting(E_ALL);
include_once("conPDO.php");
$pdo = conectar();
$data = file_get_contents("php://input");
$data = json_decode($data);
$nome = $data->nome;
$email = $data->email;
$senha = $data->senha;
$idCep = $data->idCep;
$tipoUsuario = "C";
$verificaUsuario=$pdo->prepare("SELECT * FROM usuarios WHERE nome=:nome AND email=:email");
$verificaUsuario->bindValue("nome", $nome);
$verificaUsuario->bindValue("email", $email);
$verificaUsuario->execute();
$quant = $verificaUsuario->rowCount();
if($quant != 1){
$insereUsuario=$pdo->prepare("INSERT INTO usuarios (idUsuario, idCep, tipoUsuario, nome, email, senha) VALUES (?, ?, ?, ?, ?, ?)");
$insereUsuario->bindValue(1, NULL);
$insereUsuario->bindValue(2, $idCep);
$insereUsuario->bindValue(3, $tipoUsuario);
$insereUsuario->bindValue(4, $nome);
$insereUsuario->bindValue(5, $email);
$insereUsuario->bindValue(6, $senha);
$insereUsuario->execute();
}else{
O que colocar aqui?
}
?>