我不确定此更新调用缺少什么,这是我的代码:
$table = new Application_Model_DbTable_ProductContaminant();
$db = $table->getAdapter();
$db->getProfiler()->setEnabled(true);
$data = array('value' => '999');
$where[] = $db->quoteInto('product_id = ?', $q['product_id']);
$where[] = $db->quoteInto('contaminant_id = ?', $k);
$table->update($data, $where);
print $db->getProfiler()->getLastQueryProfile()->getQuery();
分析器输出为:
UPDATE `product_contaminants` SET `value` = ? WHERE (product_id = '4802') AND (contaminant_id = 69)
为什么没有填充“值”?
最佳答案
未填充值,因为 getQuery 将仅返回带有参数占位符的准备好的语句。如果您想要更新时使用的参数,请尝试以下操作:
$db->getProfiler()->getLastQueryProfile()->getQueryParams()
更多信息here .
关于mysql - Zend db 更新值未设置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11419809/