0

I am building an application that allows users to search for other users by facebookid, email, or fullname and they need only enter a keyword. How do i build the query using connection.query? I use the mysql module. Below is my last try.

connection.query("select * from User where fullname like %? or facebook = ? or email = ? limit 50", keyword, function(err, result){
                                             ...
                                              });
Dustin Sun
  • 5,292
  • 9
  • 49
  • 87

1 Answers1

0

you need to send arguments like following

connection.query("select * from User where fullname like %? or facebook = ? or email = ? limit 50", keyword,keyword,keyword, function(err, result){
                                             ...
                                              });

because you are using '?' three time.hence,making query to take three arguments.

KlwntSingh
  • 1,084
  • 8
  • 26