0
I am having this error while trying to run this update:
Fatal error: Uncaught Exception 'Pdoexception' with message 'SQLSTATE[42000]: Syntax error or access Violation: 1064 You have an error in your SQL syntax; check the manual that Corresponds to your Mysql server version for the right syntax to use near 'WHERE id='1' at line 2' in C: wamp www siteOriginal classes funcionario.php on line 65
In case the line 65
is the execute, what I must be doing wrong ?
public function update($id){
$sql = "UPDATE $this->table SET cargo = :cargo, horastb = :horastb, salario = :salario,
WHERE id=:id";
$stmt = DB::prepare($sql);
$stmt->bindParam(':cargo', $this->cargo);
$stmt->bindParam(':horastb', $this->horastb);
$stmt->bindParam(':sa`insira o código aqui`lario', $this->salario);
$stmt->bindParam(':id', $id);
return $stmt->execute();
}
$stmt->bindParam('sa
insira o código aqui
Lario', $this->salario); You’re not passing the name of the column, you’re passing a full description of accents.... Plus I’m not sure if the $this->table inside the variable will work. Weird.....– Diego