more text manipulation
Posted: Wed Jan 21, 2004 2:34 am
this is possibly a MySQL question, but possibly not....
idally the first thing i want to do is something like this:
i have an entry in a MySQL table, in a field, which is like this: tim,jim,fred etc... (note this is in one field on 1 row, they are not separate entries/in different fields)
what i want to do is add another name to the end of that list of names... so is this possible?
could i do that? and if so is that code correct? or would it have to be done thru php?
next, i want to remove a comma and a name from the list, where $name is now the name to be removed. to do this i am going to have to go thru php right? exploding the entry around the commas, the removing the comma and that name. so, how would i do that, or is it possible through just MySQL, which would probably save a lot of coding, and if so, how?
idally the first thing i want to do is something like this:
i have an entry in a MySQL table, in a field, which is like this: tim,jim,fred etc... (note this is in one field on 1 row, they are not separate entries/in different fields)
what i want to do is add another name to the end of that list of names... so is this possible?
Code: Select all
update (table) set names=names + ',' + ". $newname ." where id='whatever'next, i want to remove a comma and a name from the list, where $name is now the name to be removed. to do this i am going to have to go thru php right? exploding the entry around the commas, the removing the comma and that name. so, how would i do that, or is it possible through just MySQL, which would probably save a lot of coding, and if so, how?