add to existing value in mysql column using CONCAT function? add to existing value in mysql column using CONCAT function? sql sql

add to existing value in mysql column using CONCAT function?


it should be

UPDATE ptb_messages SET subject = CONCAT( subject, 'newvalue')WHERE ... 

in PHP

$sql = mysql_query("UPDATE ptb_messages SET subject = CONCAT(subject, 'newvalue') WHERE id='".$message_id."'"); 

As a sidenote, the query is vulnerable with SQL Injection if the value(s) of the variables came from the outside. Please take a look at the article below to learn how to prevent from it. By using PreparedStatements you can get rid of using single quotes around values.