I have the code below in my JSP page.
The problem I am running into, is that when I use a variable in the Order By statement for the query, it doesn't recognize it.
If I hard code the Order By, it works.
This first part of code is looking for the Order_by in the url, if not found it defaults.
The second part of code is my query.
Can anyone see what I am doing wrong?
I outputed the URL variable Order_by to the screen, and it gets passed OK.
If I need to include all my page code, then let me know.
String ORDER_BY = request.getParameter("ORDER_BY");
if( ORDER_BY == null ) ORDER_BY = "CURDATE DESC";
java.sql.ResultSet columns = statement.executeQuery("SELECT * FROM MYTABLE WHERE REQOPEN='OPEN' AND NODENAME='CST' order by '"+ORDER_BY+"'");