VALUES (T_STRING) error in php

Asked

Viewed 742 times

-3

I have an error in the variables when trying to call through the database and the following message appears :

Parse error: syntax error, Unexpected 'VALUES' (T_STRING) in C: xampp htdocs Site formcadastro conexao2.php on line 24

This line is wrong :

$sql = mysql_query ("INSERT INTO cadastro ('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');

How can I fix ?

  • 3

    I advise you to learn how to interpret error messages. Otherwise it will take a long time to do anything useful, because in addition to making very basic mistakes, you have no idea what is happening. If you have to ask someone a question every time you come across a piece of shit, it’s gonna take hours to do something someone does in minutes. And still having a serious security problem.

1 answer

0


You are closing the string with " before the word VALUES.

Testing:

$sql = mysql_query("INSERT INTO cadastro ('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')";
  • It worked, thank you.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.