title: How do i retrieve data from the database using jsp
body: <p>I want to retrieve information from my database.I got the input dynamically from user using html and through jsp i get the information from the database(Mysql).The following is the jsp code</p>
  
  <pre><code>       Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/indi", "root", "");
  
  Statement statement = connection.createStatement();
  
           String id1 = request.getParameter("id");   
  
           ResultSet resultset = statement.executeQuery("select * from books where author = '" + id1 + "'") ; 
  
              if(!resultset.next()) {
                  out.println("Sorry, could not find that publisher. ");
              } else {
          %&gt;
  
          &lt;TABLE BORDER="1"&gt;
              &lt;TR&gt;
                 &lt;TH&gt;name&lt;/TH&gt;
                 &lt;TH&gt;author&lt;/TH&gt;
                 &lt;TH&gt;money&lt;/TH&gt;
                 &lt;TH&gt;company&lt;/TH&gt;
  
             &lt;/TR&gt;
  
  
             &lt;TR&gt;
                 &lt;TD&gt; &lt;%= resultset.getString(1) %&gt; &lt;/TD&gt;
                 &lt;TD&gt; &lt;%= resultset.getString(2) %&gt; &lt;/TD&gt;
                 &lt;TD&gt; &lt;%= resultset.getString(3) %&gt; &lt;/TD&gt;
                 &lt;TD&gt; &lt;%= resultset.getString(4) %&gt; &lt;/TD&gt;
  
             &lt;/TR&gt;
  
         &lt;/TABLE&gt;
         &lt;BR&gt;
         &lt;% 
             } 
      }
         %&gt;
  </code></pre>
  
  <p>I used author as a keyword to retrieve the data.Now i have 2 authors with the same name in my database but the above code fetches only one authors info i.e the first one and it leaves the other.Where should i modify in this code so that it will retrieve both the data</p>