Why this statement rs=st.executeQuery(query); is not excuting? How can I select only a table depend on input type=radio from mysql from two tables?

谁说我不能喝 提交于 2019-12-02 10:23:51

You are missing a space here in the string:

"select * from " +table+ " where username like '"+name+ "'" AND password like '"+abc+" '

Add that space in the first string and you would have the right query. And then try again.

And also you should not use String concatenation for SQL as it vulnerable to SQL injection attack. Instead use query parameters.

For more information on how to do that read here:
http://software-security.sans.org/developer-how-to/fix-sql-injection-in-java-using-prepared-callable-statement

Arul Mani

"select * from ' " +table+ " ' where username like '"+name+ "'" AND password like '"+abc+" '

U should call the value of column following format

 ' " + variablename + " '
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!