Seeking assistance to run a SQL query from JavaScript that will execute in a SQL server. The query needs to locate a user in the database based on their username and password:
var str = "SELECT * FROM Users where (username = " + params.user + ") and (password = " + params.password + ")";
The parameters, params, are sent by the user in the URL:
localhost:8888/login?user="abc"&password="123"
However, the value of str ends up as:
str = SELECT * FROM Users where (username = "abc") and (password = "123")
I attempted to use string.replace to change the double quotes with single quotes, but when I print str, it still shows double quotes instead of single.
Any recommendations? It's possible that I'm not the only one who has encountered this issue...