1

What's wrong with this statement? An error is occurring, it is not reading the second line

(($var = array('tab.order' => 'tab.order+1');)) 

$db->update('tab', $form->getValues(), array('id =?' => $id));
                        $var = array('tab.order' => 'tab.order+1');
                        $var2 = array('tab.order >= ' . $form->getValue('order'));
                        $db->update('tab', $var, $var2);
3
  • What error is occurring? Commented Mar 29, 2011 at 13:50
  • no error it just doesn't do what i wanted to do which is updating all the rows in the order attribute Commented Mar 29, 2011 at 14:15
  • What do you mean by 'it is not readying the second line'? $var does not exist, does not have the value you expect, etc? Commented Mar 29, 2011 at 17:30

1 Answer 1

1

Your problem is likely happening when Zend_Db does it's escaping of values in $var, and the value becomes

`tab.order+1`

You'll need to do

$var = array('tab.order' => new Zend_Db_Expr('tab.order + 1'));

to get around this.

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.