0
I need to do a validation in my mysql database if the email you are trying to register already exists in the database, for this I have my following code in the web service:
if ($_SERVER["REQUEST_METHOD"] == "POST") {
require 'connect.php';
inReg();
}
function inReg() {
global $connect;
$email = $_POST["email"];
$sql = "SELECT * FROM usuario WHERE email like '$email'";
$resultado = mysqli_query($connect, $sql);
if (mysqli_num_rows($resultado) <= 0) {
$nomepasta = $_REQUEST['email'];
$UploadFotos = "../../../webapps/ROOT/imagens/".$nomepasta;
//$UploadFotos = "UploadFotos/".$nomepasta;
if (!file_exists($UploadFotos)) {
if (!mkdir($UploadFotos));
}
global $connect;
$nome = $_POST["nome"];
$senha = $_POST["senha"];
$codificada = md5($senha);
$email = $_POST["email"];
$telefone = $_POST["telefone"];
$query = " Insert into usuario(nome, senha, email, telefone) values ('$nome','$codificada','$email','$telefone')";
mysqli_query($connect, $query) or die(mysqli_error($connect));
mysqli_close($connect);
} else {
? ? ? ? ? ? ? ? ? ? ? ? ? ?
}
} ?>
I don’t know what I have to return if I fall into the first condition (there is the registered email). I have to show on android app that this email has already been registered.