我正在尝试在 Zend Framework 2 中更新 MySQL 数据库中的值。我想在表中使用 where 和 Join。表结构是
-----Credit-----
ContactID
Credits
-----Token------
ContactID
Token
我想写下面的MYSQL查询
"Update credit_details
LEFT JOIN token ON token.CONTACT_ID = credit.CONTACT_ID
SET CREDITS = '200'
WHERE TOKEN ='$token';".
到目前为止,我有以下代码,但它似乎不起作用。
$this->tableGateway->update(function (Update $update) use ($token){
$update->set(array('CREDITS'=>$credits))
->join('token','token.CONTACT_ID=credit.CONTACT_ID', array( 'CONTACT_ID'=>'CONTACT_ID'
),'left')
->where($this->tableGateway->getAdapter()->getPlatform()->quoteIdentifierChain(array('token_details','TOKEN')) . ' = ' . $this->tableGateway->getAdapter()->getPlatform()->quoteValue($token));
});