After feeling the update database table form and submitting it I get this error:
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '?, user_surname=?, email=?, phone_number=?, password=?, confirm_password=? wh...' at line 1. I am using JSP on Apache Netbeans 12.6, Here is my whole validation code.
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="java.sql.*,java.util.*" %>
<% Class.forName("com.mysql.cj.jdbc.Driver"); %>
<%
String user_role=request.getParameter("user_role");
String user_name=request.getParameter("user_name");
String user_surname=request.getParameter("user_surname");
String email=request.getParameter("email");
String phone_number=request.getParameter("phone_number");
String password=request.getParameter("password");
String confirm_password=request.getParameter("confirm_password");
Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/simsdb","root","");
Statement st=con.createStatement();
int i=st.executeUpdate("update users set user_role=?, user_surname=?, email=?, phone_number=?, password=?, confirm_password=? where user_name=?");
out.println("Updated");
out.print("<br><a href=\"usermngt.jsp\"><button type=\"button\">User Management</button></a>");
%>
I have tried many update validation codes but they just don't update anything at all. As for this code it worked on Delete and Insert so I believe it should work on update also.