i just want to ask how to use REPLACE function in JSP to escape single quote like addslashes() in PHP
my code is
String task_name= request.getParameter("task_name");
String rep_task_name=task_name.replace("\'","\\\'");
st2 = con.createStatement();
st2.executeUpdate("UPDATE taskes SET task_name='"+rep_task_name+"');
thanks
DO NOT use SQL statements constructed this way, USE PreparedStatement (why):
The JDBC driver will sanitize the parameters for you.