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

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -