0

I'm not sure what's missing with this update call, here's my code:

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

And the profiler output is:

UPDATE `product_contaminants` SET `value` = ? WHERE (product_id = '4802') AND (contaminant_id = 69)

Why isn't 'value' being populated??

1 Answer 1

2

Value isn't populated because getQuery will only return a prepared statement with parameter placeholders. If you want the parameters used when it updates try this:

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

More info here.

Sign up to request clarification or add additional context in comments.

2 Comments

OK, that seems to be correct: [1] => 999. Why isn't it getting into the statement?
Of course, you cant update an empty row, can you?? Thanks for your help Tim!!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.