1
I have an error when connecting in the database,php says it does not recognize the line.
He makes the following mistake : Parse error: syntax error, Unexpected '$conexao' (T_VARIABLE) in C: xampp htdocs Site formcadastro conexao2.php on line 6
My code in php :
<?PHP
$host = "localhost";
$user = "root";
$pass = "";
$banco = "cadastrocli"
$conexao = mysql_connect($host,$user,$pass) or die(mysql_error());
mysql_select_db($banco) or die(mysql_error());
$idCad = $_POST ['idCad'];
$nome = $_POST ['Nome'];
$email = $_POST ['Email'];
$senha = $_POST ['Senha'];
$confirmar = $_POST ['Confirmar'];
$telefone = $_POST ['Telefone'];
$celular = $_POST ['Celular'];
$nascimento = $_POST ['Nascimento'];
$sexo = $_POST ['Sexo'];
$bairro = $_POST ['Bairro'];
$cidade = $_POST ['Cidade'];
$estado = $_POST ['Estado'];
$sql = mysql_query "(INSERT INTO cadastrocli (idCad, Nome, Email, Senha, Confirmar, Telefone, Celular, Nascimento, Sexo, Bairro, Cidade, Estado)
VALUES ('$idCad', '$nome', '$email', '$senha', '$confirmar', '$telefone', '$celular', '$nascimento', '$sexo', '$bairro', '$cidade', '$estado');"
echo"Cadastro efetuado com sucesso;"
?>
So I modified but still the error persists.
– Somogys
I edited the answer to show that it works. Then the problem is another and specific in your environment. Then we have no way of knowing what happens. The reason for closing the question remains the same, because it is either a typo or it cannot be reproduced. Take a look if you’re not doing something wrong, if you’re saving the edited one at the right place, if the mistake has moved. If you have another error, open another question.
– Maniero
In Google while trying to run, keeps giving the same error,It is not typing error because I have already checked, what can be if it is an error in the variables when being called.
– Somogys
But google does not run code.
– João Sobral
It was clearly a typo, so if you have another problem, open a new question with enough information to help. The only thing I can add that this code is asking for is to take an attack and steal and destroy the database. And I don’t know what Google means in this context. The contexts I know, it doesn’t really work, it’s not his job to run PHP code. If you want help, give enough information to be helped. Playing words without nexus will not help you.
– Maniero