Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-18-2008, 08:49 AM
Junior Member
 
Join Date: Nov 2007
Posts: 7
Default update replace

I need to do a query like this:

UPDATE my_table set text = REPLACE(text,'oldtext','newtext') where text REGEXP 'oldtext'

But dunno how to do that using Zend_Db_Table->update

Anyone knows?
Thx.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 08-18-2008, 11:09 AM
Member
 
Join Date: Jul 2008
Posts: 60
Default

How about:
Code:
$bind = array(
  'text' => new Zend_Db_Expr("REPLACE(text, 'oldtext', 'newtext')")
);
$db->update('my_table', $bind, "text REGEXP 'oldtext'");
If you have something that doesn't need escaping (eg. an expression) you can generally wrap it in a Zend_Db_Expr object.
__________________
Brenton Alker
Brisbane, Australia

http://blog.tekerson.com/

Last edited by Tekerson : 08-18-2008 at 11:10 AM. Reason: Syntax error
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 10:39 PM.