title: PDOStatement::execute(): SQLSTATE[HY093]: Invalid parameter number: parameter was not defined
body: <p>Below is my code, I am not able to resolve this error. Any help is appreciated. I am trying to update a table in my database. </p>
  
  <pre><code>    public function updateUnit($params){
      $user = 'monil';
      $password = 'Masters123';   
      $dbh = new \PDO('mysql:host=127.0.0.1;dbname=tcsdb', $user, $password);
  
      $task=array(':UnitCode'=&gt;$params['UnitCode'],':UnitDescription'=&gt;$params['UnitDescription']    ,
        ':UnitName'=&gt;$params['UnitName'], ':UnitID'=&gt;$params['UnitID']);
      echo $params['UnitID'];
  
      $sth = $dbh-&gt;prepare('UPDATE unit SET UnitCode = :UnitCode,'
          . 'UnitDescription = :UnitDescription,UnitName = :UnitName WHERE UnitId=:UnitId');
      $sth-&gt;execute($task); 
  
      return true;
  }
  </code></pre>