javascript - adding to a value in a database not replacing it -
so storing users 'freinds' in database , using add there freind
socket.on('addfreind', function(username, freind) { console.log("add freind " + freind + "to " + username) let query = 'update users set freinds="' + freind + '" username = "' + username + '"'; connection.query(query, function(err) { console.log(err) }); });
but replaces original value new 1 how can add original value
i have tried querying original value , adding array , adding new value array putting in database failed horribly , wondering if there simple way
Comments
Post a Comment