Gabriel, first let's imagine what a UPDATE
would be, regardless of whether you use PHP
to execute it. It would be something like:
UPDATE nome_da_tabela
SET campo1 = valor_campo1,
campo2 = valor_campo2,
campoN = valor_campoN
WHERE condicao_aqui;
You enter the table name , and in SET
you can put 1 or more fields with your values for the update, separated by commas . And finally, with WHERE
, puts the conditions to filter the records , otherwise the whole table will be updated.
Now let's see this code:
$sql = "UPDATE doador SET nome=?,cpf=?,datadenascimento=?"
. "sexo=?,endereco=?,complemento=?,bairro=?,cidade=?"
. "estado=?,cep=?,email=?,senha=?,telefone=?,perfil=?,datacadastro=? "
. "WHERE iddoador = " . $AlterarDoador->getIddoador() . ";";
We can already notice that in the change of the lines you forgot to separate the fields by comma. The correct one would look like this:
$sql = "UPDATE doador SET nome=?,cpf=?,datadenascimento=?,"
. "sexo=?,endereco=?,complemento=?,bairro=?,cidade=?,"
. "estado=?,cep=?,email=?,senha=?,telefone=?,perfil=?,datacadastro=?, "
. "WHERE iddoador = " . $AlterarDoador->getIddoador() . ";";
If after this fix continues with error, make sure you have entered values for all parameters , in the $stmt->bindValue
lines.
If the error persists, change your question by entering it.