I have this code
$db = Zend_Db_Table_Abstract::getDefaultAdapter();
$users_table = new Application_Model_UserModel();
$result = $users_table->update(array(
"confirmed" => 1,
"key" => null
), array(
$db->quoteInto("'type' = ?", Application_Model_UserModel::TYPE_AWATAG),
"'confirmed' = 0",
$db->quoteInto("'id' = ?", $id),
$db->quoteInto("'key' = ?", $key)
));
// no record updated
if ($result == 0) {
throw new Zend_Exception("User not found.");
}
that throws the exception (ie: the user record has not been updated), even that all the where conditions are correct.
Is a bug? Do you see any error?
Solution
I unquoted all columns name and added table reference in this way:
tablename.columnname = newvalue
Thanks for watching :)