wright67uk Posted November 30, 2011 Share Posted November 30, 2011 Im trying to add some info to an existing cell in a mysql database. The cell currently reads: This is a piece of information. I would like to update the cell to read: This is a piece of information. a great piece of info. I have a variable with the following; $info = a great piece of info. Is it possible to add $info to the existing cell via php eg. <?php mysql_query("UPDATE mytable SET info = '$info' WHERE row = '$row'"); ?> all fine except I dont want to SET the info to $info I simply want to add $info onto the end of the existing data in the info record. Is this possible and how do i change the above query and go about it? Many thanks Quote Link to comment https://forums.phpfreaks.com/topic/252157-adding-info-to-an-existing-mysql-cell-is-it-possible/ Share on other sites More sharing options...
Alex Posted November 30, 2011 Share Posted November 30, 2011 You can use the MySQL CONCAT() function. UPDATE mytable SET info = CONCAT(info, '$info') WHERE row = '$row' Quote Link to comment https://forums.phpfreaks.com/topic/252157-adding-info-to-an-existing-mysql-cell-is-it-possible/#findComment-1292795 Share on other sites More sharing options...
wright67uk Posted November 30, 2011 Author Share Posted November 30, 2011 Brilliant, works well. and thankyou very much. Quote Link to comment https://forums.phpfreaks.com/topic/252157-adding-info-to-an-existing-mysql-cell-is-it-possible/#findComment-1292820 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.