I have a table of users and their information and a different table to keep track of friends: setting up a friend list in mysql
I am trying to do something like this using jade, profile.jade:
- each user in users
h1='Welcome to '+user.username+' profile!'
- each friend in friends
p=row.friend2
express
function select(id, res) {
connection.query(' SELECT * FROM profiles WHERE username = "'+id+'" ' , function(err, rows){
res.render('profile', {users : rows});
});
connection.query(' SELECT * FROM friends WHERE friend1 = "'+id+'" ' , function(err, rows){
res.render('profile', {friends: rows});
});
}
^ What is the proper way to do this?