1

I've got this query, from what I've found of examples here and in the docs this should work, but the script is saying no.. needs array not string. Do I have to do something like

$db = $this->db = Zend_Registry::getinstance()->dbAdapter;
$db->select()->from('offer_term')->where('term_id = '.$entry[$i]);
$db->update('status = 0');

with the above I get an error about it not taking a string it needs to be an array.

with the below my whole script breaks. So, I'm kinda new to Zend, anyone care to elaborate as to what I am doing wrong?

$db = $this->db = Zend_Registry::getinstance()->dbAdapter;
$db->select()->from('offer_term')->where('term_id = ?',array($entry[$i]));
$db->update('status = ?', array('0'));
0

1 Answer 1

3

Please have a look at the Zend Framework documentation of update() here.

The method's signature is:

$db->update($table, $data, $where);

This means that you'll have to let the adapter know which table you are updating, as well as which row(s) from that table.

You should probably rewrite your code to:

$db->update(
    'offer_term', 
    array('status' => 0), 
    array('term_id = ?' => $entry[$i])
);

This will translate into:

UPDATE offer_term
SET status = 0
WHERE term_id = <myEntry>
Sign up to request clarification or add additional context in comments.

Comments

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.