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 8881717
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:24:03+00:00 2026-06-14T20:24:03+00:00

I want to retrieve information from my database.I got the input dynamically from user

  • 0

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

       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 {
        %>

        <TABLE BORDER="1">
            <TR>
               <TH>name</TH>
               <TH>author</TH>
               <TH>money</TH>
               <TH>company</TH>

           </TR>


           <TR>
               <TD> <%= resultset.getString(1) %> </TD>
               <TD> <%= resultset.getString(2) %> </TD>
               <TD> <%= resultset.getString(3) %> </TD>
               <TD> <%= resultset.getString(4) %> </TD>

           </TR>

       </TABLE>
       <BR>
       <% 
           } 
    }
       %>

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

  • 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-14T20:24:04+00:00Added an answer on June 14, 2026 at 8:24 pm

    try to make a loop on resultset.

    while(rs.next( )){  
       %>
    <TABLE BORDER="1">
            <TR>
               <TH>name</TH>
               <TH>author</TH>
               <TH>money</TH>
               <TH>company</TH>
    
           </TR>
    
    
           <TR>
               <TD> <%= resultset.getString(i) %> </TD>
               <TD> <%= resultset.getString(i+1) %> </TD>
               <TD> <%= resultset.getString(i+2) %> </TD>
               <TD> <%= resultset.getString(i+3) %> </TD>
    
           </TR>
    
       </TABLE>
       <BR>
    
    
     <% }  %>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to serialize some information I retrieve from the user in a small
I'm trying to retrieve information from an Oracle database using XQuery. The table customer
i want to retrieve information from my database quite a lot throughout my app,
I have a HTML table as follows. I want retrieve row values from this
I'm trying to retrieve information from my database, and output it to my page.
I am trying to select users information from my database but I only want
I am trying to retrieve information from my database. I have words like Lim
I have saved some information in database with MySQL, now i want to show
I have several DAO objects that are used to retrieve information from a database
I want to retrieve the database contents from a website and use it in

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.