Greetings everyone, i had a trouble while updating the query.
I tried to update an existing table using this query, but got an error. Here’s my code:
$qb = $this->db->getQueryBuilder();
$qb->update($this->getTableName())
->set('h_condition', $health_condition)
->where(
$qb->expr()->eq('employee_id', $qb->createNamedParameter($employee_id))
);
$qb->execute();
Note:
$employee_id = 49 and $health_condition = “Healthy”
In DB; employee_id is PK, int & auto-increment, h_condition is varchar.
The error message is:
Doctrine\DBAL\Exception\InvalidFieldNameException: An exception occurred while executing ‘UPDATE
oc_employee
SETh_condition
=Healthy
WHEREemployee_id
= ?’ with params [49]: SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘Healthy’ in ‘field list’
Could you help to shed some light? Thanks in advance.
Best Regards,
Travis