Blog Details

concate field data using update query in php mysql


UPDATE tableName SET fieldName = CONCAT(fieldName, 'New Data To Add Here') WHERE ...

example :

     UPDATE ws_contact SET webpage = CONCAT(webpage, '') WHERE id=1 But this query will not work if the field is NULL (which makes sense as there is nothing to append),  you can use below query to solve NULL problem UPDATE tableName SET field = CONCAT(COALESCE(field, ''), 'New Data') WHERE ... example :      UPDATE ws_contact SET webpage = CONCAT(COALESCE(webpage, ''), '') WHERE id=1 Basically this check whether the field is NULL or not. If it's NULL then it will automatically use blank data for the field otherwise it'll default to the field's value. Then, it will do the concatenation of the new data.
 You could also use IFNULL() instead of COALESCE()


Php mysql

Latest posts

Implementing CRUD Operations ¶

<ul> <li>Now comes the fun part. We would like t


<ol> <li><a href="

Creating Model

<ol> <li><a href="

Get Free Quote