Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9214891
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T02:04:27+00:00 2026-06-18T02:04:27+00:00

i´m trying to update rows in mysql table , i´m using html form for

  • 0

i´m trying to update rows in mysql table, i´m using html form for data insertion. In html form attribute value i´m using an existing data from database.

Edit.jsp

<form action="Update.jsp">
                <%  Class.forName("com.mysql.jdbc.Driver").newInstance();
                    Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "root");
                    Statement st = con.createStatement();
                    ResultSet rs = st.executeQuery("select u.login,i.name,i.surname,i.age,i.tel,i.email,a.street,a.town,a.zip,ul.name,t.name from users u join info i on i.user_id=u.user_id join user_level ul on ul.ulevel=u.ulevel join teams t on t.team_id=u.team_id join adress a on a.info_id=i.info_id where u.login='" + session.getAttribute("uzivatel") + "'");
                    while (rs.next()) {
                %>

                <div class="well well-large">
                    <font size="2"><b>Welcome, </b></font><font color="RED"><i><%= session.getAttribute("uzivatel")%></i></font><br>
                    <b>Name:</b> <input type="text" name="name" value="<%= rs.getString(2)%>"><input type="text" name="surname" value="<%= rs.getString(3)%>"> <br>
                    <b>Age:</b> <input type="text" name="age" value="<%= rs.getString(4)%>"><br>
                    <b>Telephone:</b> <input type="text" name="tel" value="0<%= rs.getString(5)%>"><br>
                    <b>E-mail:</b> <input type="text" name="email" value="<%= rs.getString(6)%>"><br>
                    <b>Adress:</b> <input type="text" name="street" value="<%= rs.getString(7)%>"><input type="text" name="town" value="<%= rs.getString(8)%>"><input type="text" name="zip" value="<%= rs.getString(9)%>"><br>
                    <b>User level:</b> <%= rs.getString(10)%><br>
                    <b>Team:</b> <%= rs.getString(11)%><br>
                    <input type="submit" name="Submit" value="Update" />
                </div>
            </form>

Update.jsp

<%
                String name = request.getParameter("name");
                String surname = request.getParameter("surname");
                String age = request.getParameter("age");
                String telephone = request.getParameter("tel");
                String email = request.getParameter("email");
                String street = request.getParameter("street");
                String town = request.getParameter("town");
                String zip = request.getParameter("zip");

                try {
                    Connection conn = null;
                    Class.forName("com.mysql.jdbc.Driver").newInstance();
                    conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "root");
                    Statement st1 = null;
                    st1 = conn.createStatement();
                    System.out.println(session.getAttribute("uzivatel"));
                    st1.executeUpdate("UPDATE users JOIN info ON users.user_id = info.user_id"
                            + " JOIN adress ON info.info_id = adress.info_id"
                            + "SET info.name = '"+name+"',info.surname = '"+surname+"',"
                            + "info.age = '"+age+"',info.tel = '"+telephone+"',info.email = '"+email+"',"
                            + "adress.street = '"+street+"',adress.town = '"+town+"',adress.zip = '"+zip+"',"
                            + "WHERE users.login ='" + session.getAttribute("uzivatel") + "'  ");
                    response.sendRedirect("AdministrationControlPanel.jsp");
                } catch (Exception e) {
                    System.out.println(e.getMessage());
                }
            %>

When I pressed the Submit button, it redirected me to Update.jsp and nothing was changed.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T02:04:28+00:00Added an answer on June 18, 2026 at 2:04 am

    There is problem in your query that is why you are not getting any result. give space at properly when you are dividing the string in various lines.
    system.out.println() will show message on the console not on the page

    st1.executeUpdate("UPDATE users JOIN info ON users.user_id = info.user_id"
                            + " JOIN adress ON info.info_id = adress.info_id "
                            + "SET info.name = '"+name+"',info.surname = '"+surname+"', "
                            + "info.age = '"+age+"', info.tel = '"+telephone+"', info.email = '"+email+"',"
                            + "adress.street = '"+street+"',adress.town = '"+town+"',adress.zip = '"+zip+"', "
                            + "WHERE users.login ='" + session.getAttribute("uzivatel") + "'  ");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to update multiple rows in one table in MySQL database by doing
I am trying to update multiple rows on one table using MySQL. I have
I am trying to update rows in a data table that intersect rows in
I am trying to load data from a text file into a MySQL table,
I'm trying to delete a row from a table in MySQL using the PHP
I'm using the MySql.Data dll from MySql and trying to execute a query to
I'm trying to run a UPDATE using REPLACE on my MySQL database. I have
I am trying to select from a mySQL table using prepared statements. The select
So I'm trying to import some sales data into my MySQL database. The data
What i am trying to do is recover data from a table and add

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.