PHP MYSQL CONCAT with string containing comma in the start -


its strange problem having. trying update value in database table new 1 concatenating old , new values comma in between. value is: hello , updating world , want new value hello,world unable this. both concat , concat_ws functions through error have invalid syntax.

table name fields. column wish update values , new value concatenated $newval. here query.

$sql="update fields set values=concat_ws(',',values, '$newval') name='fundtype'"; 

i error:

you have error in sql syntax; check manual corresponds mysql server version right syntax use near 'values=concat_ws(',',values, 'buyout') name='fundtype'' @ line 1 

any appreciated. ahmar a.

values keyword of mysql. use backticks `` mark field name:

$sql="update fields set `values`=concat_ws(',',`values`, '$newval') name='fundtype'"; 

Comments

Popular posts from this blog

matlab - Deleting rows with specific rules -

php - MySQLi multi_query results for later use -