$db->query_write(" UPDATE " . TABLE_PREFIX . " post SET pagetext = REPLACE(pagetext, '".$db->escape_string(trim($val))."' , 'another-word') ");