javascript - Checking to see if a word exist inside of a row in my mysql database with node.js -
so trying allow users add friends , storing of there friends inside of single row of database here code using
socket.on('addfreind', function(username, freind) { console.log("add freind " + freind + " " + username) connection.query("update users set freinds = concat(freinds,'' ' " + freind + "') username = ?", [username], function(err) { console.log(err) }); });
it add friends fine if there friend name of nik still allow add him
i tried check if user existed in row nothing happened
if (connection.query("select * users instr(freinds, '" + freind + "'") > 0) { console.log("something") }
what can fix this
Comments
Post a Comment