ggutigod
ggutigod

Reputation: 13

Column not found: 1054 Unknown column in cake php

I am facing a issue during update query.

MODEL CODE

public function resetpassword($key,$password)
{
$aresetpassword = $this->updateAll(array('Register.password'=>$password), array('Register.key'=>$key)); 
return($aresetpassword);
}

VIEW PAGE ERROR

Error: SQLSTATE[42S22]: Column not found: 1054 Unknown column '8815061c1a6c63398b9a2dfb1f44aae89dd59bfd' in 'field list'

SQL Query:

UPDATE `milgyonu_mber`.`registers` AS `Register` 
SET `Register`.`password` = 8815061c1a6c63398b9a2dfb1f44aae89dd59bfd 
WHERE `Register`.`key` = '656abe3991a51c62e860b8d1401e4f49'

Event password field is exists in my table.

Upvotes: 0

Views: 1842

Answers (1)

ADmad
ADmad

Reputation: 8100

As stated in the manual when using Model::updateAll() you need to manually quote literals in $fields argument. So use array('Register.password'=> '"' . $password . '"')

Upvotes: 6

Related Questions