Zend_DB_Table Update problem
Am trying to construct a simple update query开发者_高级运维 in my model
class Model_DbTable_Account extends Zend_Db_Table_Abstract
{
protected $_name = 'accounts';
public function activateaccount($activationcode)
{
$data = array(
'accounts_status' => 'active',
);
$this->update($data, 'accounts_activationkey = ' . $activationcode);
}
However I get an
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'my activation code value'
in 'where clause'
error.
What am I missing in Zend_Table update construct?
After spending some time on this issue I found the solution and I decided to post it for anyone who might come across the same problem.
I changed
$this->update($data, 'accounts_activationkey = ' . $activationcode);
to
$this->update($data, 'accounts_activationkey = ' .(int)$activationcode);
精彩评论