title: JDBC Table updating only first row
body: <p>Hi When i'm trying to update a jdbc table only first row gets updated below is the code for it. though i have an individual button for every row any button i clicks takes input values as first row's.</p>
  
  <pre><code>&lt;tr&gt;
             &lt;td&gt;&lt;%=rs.getString("DBID")%&gt;&lt;/td&gt;
             &lt;td&gt;&lt;input type="text" name="prev" id="prev" value="&lt;%=rs.getString("Query_Raised")%&gt;" border=''&gt;&lt;/td&gt;
             &lt;td&gt;&lt;%=rs.getString("TR")%&gt; &lt;/td&gt;
             &lt;td&gt;&lt;%=rs.getString("Query_Answered")%&gt;&lt;/td&gt;
             &lt;td&gt;&lt;%=rs.getString("TA")%&gt;&lt;/td&gt;
             &lt;td&gt;&lt;input type="submit" value="Edit"&gt;
         &lt;/tr&gt;
  </code></pre>
  
  <p>and for comparing i used the below(for where condition) and it is also taking only the first row value</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
      &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt;
      &lt;title&gt;JSP Page&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;&lt;form method="post" action="Up_Query_DB.jsp"&gt;
          &lt;table&gt;&lt;tr&gt;&lt;td&gt; &lt;input type="text" id="xyz" name="xyz" value="&lt;%=request.getParameter("prev")%&gt;"&gt;&lt;/td&gt;&lt;/tr&gt;
              &lt;tr&gt;&lt;td&gt;&lt;INPUT TYPE="TEXT" NAME="updat" id="updat"&gt;&lt;/td&gt;&lt;/tr&gt;
              &lt;tr&gt;&lt;td&gt;&lt;input type="submit" value="Update"&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/form&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p></p>
  
  <p>and the update i used is</p>
  
  <pre><code>&lt;% try
                   {
     String sc=request.getParameter("xyz");
     String upd=request.getParameter("updat");
     ps=con.prepareStatement("Update Scope1 Set Query_Raised='"+upd+"' where Query_Raised='"+sc+"'");
     int i=ps.executeUpdate();
     if(i==1)
                   {
         String redirectURL= "View Queries.jsp";
         response.sendRedirect(redirectURL);
  
     }
           else{
         out.print("Erro");
           }
   }
     catch(Exception e)
                     {
      out.println("error");
  
     }%&gt;
  </code></pre>
  
  <p>Thanks</p>