How to get data from database in javascript based on the value passed to the function

前端 未结 3 999
不知归路
不知归路 2020-12-10 00:00

In my web application, I want to retrieve data from database based on the value that is passed to the function. I wrote the query as follows.



        
3条回答
  •  遥遥无期
    2020-12-10 00:21

    The error is coming as your query is getting formed as

    SELECT * FROM Employ where number = parseInt(val);
    

    I dont know which DB you are using but no DB will understand parseInt.

    What you can do is use a variable say temp and store the value of parseInt(val) in temp variable and make the query as

    SELECT * FROM Employ where number = temp;
    

提交回复
热议问题