-1
I am not able to identify the error. I have always set up structures like this, but now this error appears.
Parse error: syntax error, Unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting '-' or Identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING)
$inserir = $conexao->query("INSERT INTO cadastro (nome, sobrenome, email, senha, contrata, trabalha, status) VALUE (
$_POST['nome'],
$_POST['sobrenome'],
$_POST['email'],
password_hash($_POST['senha'], PASSWORD_DEFAULT)."\n",
$_POST['contrata'],
$_POST['trabalha'],
'N'
)");
I AM USING THESE VERSIONS:
PHP = 7.1.6
Mysql = 5.7.11
@Inkeliz Different subjects, different mistakes.
– Tiago
Trade this piece
PASSWORD_DEFAULT)."\n",
forPASSWORD_DEFAULT),
– rray
@rray Error remains.
– Tiago
Log this one of yours
insert
, copy and run in PHP Myadmin or Mysql console itself to more easily identify the error that is returning...– wBB
@wBB How to mount the log?
– Tiago
You save your entire SQL sentence in a variable and have it printed on the same screen, with
echo
:$sql = "INSERT INTO cadastro (nome, sobrenome, email, senha, contrata, trabalha, status) VALUE (
 $_POST['nome'],
 $_POST['sobrenome'],
 $_POST['email'],
 password_hash($_POST['senha'], PASSWORD_DEFAULT)."\n",
 $_POST['contrata'],
 $_POST['trabalha'],
 'N'
 )"
and executesecho $sql;
then. Then you will see exactly what is sending to the database.– wBB
can also print on console:
echo '<script>console.log('.$sql.')</script>';
– wBB
Try to echo the mounted sql to see the result
– Mauricio Wanderley Martins
I think your query is wrong, no? is VALUES plural
– Bruno Folle
And the concatenation of the arrays inside the double quotes looks like this: {$_POST['name']}
– Bruno Folle
Please do not duplicate questions, this is totally wrong to do in the community. Thank you for understanding.
– Guilherme Nascimento