开发者

Zend Framework compound primary key update

For a project I need to update a row where the PK contains two columns.

At first I thought I should do it like this but it gives me errors. Anybody with a solution?

$data = array('foo','bar');
$where = $this->_getGateway()->getAdapter()
                    ->quoteI开发者_JAVA技巧nto(array('customerId=?','date=?'), array($comment->customerId, $comment->date));
$this->_getGateway()->update($data, $where);

Thanks


Got it!

$whereId = $this->_getGateway()->getAdapter()->quoteInto('customerId=?', $comment->customerId);
$whereDate = $this->_getGateway()->getAdapter()->quoteInto('date=?', $comment->date);
$this->_getGateway()->update($data, array($whereId, $whereDate));
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜