Guest User

Untitled

a guest
Jun 13th, 2012
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. php, how to search and replace in mysql database?
  2. foreach($rowset as $row) {
  3. $replacement=preg_replace('/<strong>(.)/','1<strong>',$row->fieldname,1);
  4. myDBCall('update mytable set myfield="'.$replacement.'" where someid='.$row->someid);
  5. }
  6.  
  7. update `table` set `fieldname` = replace(`fieldname`,'string_to_find','string_to_replace_with')
Advertisement
Add Comment
Please, Sign In to add comment