UPDATEing a MySQL SET where values contain commas

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
webcan
Forum Commoner
Posts: 66
Joined: Tue Oct 28, 2003 2:25 pm
Location: Toronto, Canada

UPDATEing a MySQL SET where values contain commas

Post by webcan »

Hey guys -

Can someone help me out here?

I know how to extract and form a SQL query to update a SET in SQL that contains regular values, such as `var` = 'one,two,three', but what do you do when one of the values has a comma in it:

`var` = '$10,000,$20,000,$30,000'

That's obviously wrong. I tried \, and it didn't work either.

Thanks,
Peter.
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

my first thought would be to redesign the database.

you can also use ; or whatever as a separator
$100,000;$20
webcan
Forum Commoner
Posts: 66
Joined: Tue Oct 28, 2003 2:25 pm
Location: Toronto, Canada

Post by webcan »

Hi there - using a semi-colon didn't work.

I don't want to "redesign the database" because these SET values are actually used to create the SELECT drop-down itself.

Any other suggestions?
Post Reply