0

この更新呼び出しで何が欠けているのかわかりません。これが私のコードです:

$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)

「値」が設定されていないのはなぜですか??

4

1 に答える 1

2

getQuery は、パラメーター プレースホルダーを含む準備済みステートメントのみを返すため、値は入力されません。更新時に使用されるパラメーターが必要な場合は、これを試してください。

$db->getProfiler()->getLastQueryProfile()->getQueryParams()

詳細はこちら

于 2012-07-10T18:52:59.500 に答える