Edit a TEXT field
Posted: Wed Aug 20, 2003 11:27 am
Hello all,
I need to edit a comma delimited string in a MySQL TEXT type column.
I want to remove one element of the string.
IE:
column keywords: one, two, three, four, five, six
I want to remove 'four' from the string. // gives: one, two, three, five, six
I thought of doing a 'SELECT keywords FROM products WHERE keyword LIKE %four%'
and then while looping through the resulting recordset use preg_replace()
on each record and then UPDATE that record with the cleaned up string.
Do you know of a more MySQL way of doing this? Some built in function I'm missing?
Thanks,
- D
I need to edit a comma delimited string in a MySQL TEXT type column.
I want to remove one element of the string.
IE:
column keywords: one, two, three, four, five, six
I want to remove 'four' from the string. // gives: one, two, three, five, six
I thought of doing a 'SELECT keywords FROM products WHERE keyword LIKE %four%'
and then while looping through the resulting recordset use preg_replace()
on each record and then UPDATE that record with the cleaned up string.
Do you know of a more MySQL way of doing this? Some built in function I'm missing?
Thanks,
- D