Doubt update php

0

I'm having a hard time changing the status of user(1 -> ativo, 0-> desativo) . I get the following error message:

  Invalid parameter number: number of bound variables does not match number of tokens in C: \ xampp \ htdocs \ paw_EpN_G44 \ Application \ Database \ MyDataAccessPDOBase. php: 161 Stack trace: # 0 C: \ xampp \ htdocs \ paw_EpN_G44 \ Application \ Database \ MyDataAccessPDOBase.php (161): PDOStatement-> Run (Array) # 1 C: \ xampp \ htdocs \ paw_EpN_G44 \ Application \ Database \ MyDataAccessPDO.php (155): MyDataAcessPDOBase-> PrepareStatement ('UPDATE user SET ...', Array) # 2 C: \ xampp \ htdocs \ paw_EpN_G44 \ Application \ Manager \ UserManager.php (103): MyDataAccessPDO- & gt ; update ('user', Array, Array) # 3 C: \ xampp \ htdocs \ paw_EpN_G44 \ AreaAdmin \ changeProperty.php (29): UserManager-> update_status ('gui', '0') # 4 {main} thrown in C: \ xampp \ htdocs \ paw_EpN_G44 \ Application \ Database \ MyDataAccessPDOBase.php on line 161

I have the following code:

$userManager = new UserManager();

$username = filter_input(INPUT_POST, 'username', FILTER_SANITIZE_STRING);
$myclient = $userManager->getUserByUsername($username);
$novoestado = $myclient['estado'];


if ($myclient['estado'] === "1") {
    $novoestado = "0" ;
} else {
  $novoestado = "1" ;
}

$userManager->update_estado($username, $novoestado);

Where update_estado is:

public function update_estado($user, $estado) {
        try {
            return $this->update(self::SQL_TABLE_NAME, 
                    Array('estado' => $estado),Array('username' => $user));
        } catch (Exception $e) {
            throw $e;
        }
    }
    
asked by anonymous 26.06.2017 / 15:10

0 answers