completeamateur 0 Posted November 30, 2008 Share Posted November 30, 2008 Hi guys, I'm trying to create a simple query to update some records. $this->update(array('lft'=>'lft + 2'), 'lft > ' . $lft); This works fine, except it does not write the correct value in the lft column, it just writes '0', where as it should be 'lft + 2' i.e. the original value + 2. I'm not quite sure what I'm doing wrong. TIA Link to post Share on other sites
trq 255 Posted November 30, 2008 Share Posted November 30, 2008 That code allone doesn't make much sense without context. You should at least inform us what framework / library your using. Link to post Share on other sites
completeamateur 0 Posted November 30, 2008 Author Share Posted November 30, 2008 Apologies, I'm using Zend Framework 1.5 Link to post Share on other sites
Daniel0 2 Posted December 2, 2008 Share Posted December 2, 2008 Try $this->update(array('lft'=> new Zend_Db_Expr('lft + 2')), 'lft > ' . $lft); Which class does $this refer to here? Link to post Share on other sites
completeamateur 0 Posted December 2, 2008 Author Share Posted December 2, 2008 Daniel, that's worked a treat. It was trying to enter it as a string rather than an expression. Thank you so much. Link to post Share on other sites
Daniel0 2 Posted December 2, 2008 Share Posted December 2, 2008 No problem. Remember to click the "Topic Solved" button when you're done. I did it for you this time though Link to post Share on other sites
Recommended Posts
Archived
This topic is now archived and is closed to further replies.