Skip to content

Update statement with different id column not working #6

@Hinkie

Description

@Hinkie

Hello, the following function wasn't working for me:
$db->updateCliente('cliente', [ 'nome_cliente' => $nome_cliente, 'tel1' => $tel1, 'tel2' => $tel2, 'endereco' => $endereco ],['id_cliente',1]);

So I used var_dump and got:
...UPDATE cliente SET nome_cliente = ?,tel1 = ?, te2l = ?, endereco = ? WHERE id = ?"...

The issue is that 'id' didn't chage to 'id_cliente'.
To fix that I copied the update function and manually changed line 241 from
$this->where .= "id = ?";

To

$this->where .= "id_cliente = ?";

Thank you

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions