I feel a little stupid about this one, but to be fair, you can't know everything. In MySQL you can 'update' part of a field (like search and replace) with the 'replace' function:

update [table_name] set [field_name] = replace([field_name], '[string_to_find]', '[string_to_replace]');

I've always just written a little program to select all records and then loop through and do the replace in PHP. This is obviously much easier. Google is my friend.
- jim 12-21-2008 8:02 pm




add a comment to this page:

Your post will be captioned "posted by anonymous,"
or you may enter a guest username below:


Line breaks work. HTML tags will be stripped.