How can i convert this php script to JavaScript in a Node project [closed]

I have a nodejs server running, and I’m using SQL syntax to query data from my MYSQL database.

This is the PHP script:
enter image description here

This is my nodejs code:

enter image description here

Results are not coming as expected