Run a SQL query in JS

后端 未结 4 492
挽巷
挽巷 2021-02-04 13:30

I want to run a SQL query in a .JS file. I tried to add some PHP codes to it but it didn\'t work of course.

I want to run the SQL query: SELECT price FROM list WH

4条回答
  •  执念已碎
    2021-02-04 14:11

    You cannot connect to Mysql directly from client side JS, but only from server side JS, such as node. It can just like PHP connect using PDO or mysqli extensions, run your query and then pass the information to client side JS.

提交回复
热议问题