Jump to content

Concatenate data to existing data in a column


niche

Recommended Posts

What's the notation to concatenate data to existing data in a field?mysql_query("UPDATE stk SET some_field = '????????????' WHERE id = " . $upc_key . "") or die(mysql_error());

Link to comment
Share on other sites

UPDATE stk SET some_field = CONCAT(some_field, "more_data") ...

Link to comment
Share on other sites

no joy:mysql_query("UPDATE disclaimers SET disclaimer = CONCAT(disclaimer,"ABCD") WHERE id = '1'") or die(mysql_error());or:mysql_query("UPDATE disclaimers SET disclaimer = CONCAT(disclaimer,"ABCD") ") or die(mysql_error());Both produce a parse error.

Link to comment
Share on other sites

Ahhhhh!mysql_query("UPDATE disclaimers SET disclaimer = CONCAT(disclaimer,'ABCD') WHERE id = '1'") or die(mysql_error());succeeded!Thanks Synook!EDIT: Time to watch CHAOS.

Link to comment
Share on other sites

By the way, the reason why your previous statements weren't working was because you didn't escape your quotes.

Link to comment
Share on other sites

Again, thanks for your help. There's obviously a difference between getting "it" to work and knowing why "it" works. I haven't actually needed to escape quotes before except in tutorials. Thanks, Niche.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...