session.getAttribute('loginId')//giving 1
ResultSet rs=st.executeQuery("select * from interest where loginid='session.getAttribute('loginId')'");
or
ResultSet rs=st.executeQuery("select * from interest where loginid='session.getAttribute("loginId")'");
this is giving me sql Exception.
what wrong in my query? while-
ResultSet rs=st.executeQuery("select * from interest where loginid='1'");
is running fine.
I cant call this by storing loginId in String Object.
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'loginId')'' at line 1