-1
I am using this function in my form but I have a problem.
It is validating the field and is not included in the comic, but the message instead of saying that the client already exists is saying that it has been successfully registered.
how to fix this?... if it already exists in the comic book it informs that the client already exists and if it does not exist it informs that it has been registered?
my Cód is like this:
$search = mysql_query("SELECT * FROM clientes WHERE cnpj = '$cnpj'");
if(@mysql_num_rows($search) > 0){
echo 'Esse Cliente já existe';
}else
// faz inserção
mysql_query("INSERT INTO clientes (dia,mes,ano,data2,nome,fantasia,contato,fone,celular,email,cnpj,estadual,endereco,cep,bairro,cidade,estado,nf,desconto,obs) values
('$dia','$mes','$ano','$data2','$nome','$fantasia','$contato','$fone','$celular','$email','$cnpj','$estadual','$endereco','$cep','$bairro','$cidade','$estado','$nf','$desconto','$obs')");
}
}
echo '<script type="text/javascript">
alert("Registro Incluído com Sucesso!!!");
</script>';
//Atualize a página
echo
'<script type="text/javascript">location.replace("clientes.php");</script>';
Thanks was that, now it worked correctly..... thank you very much
– Robert