title: Trying to retrieve multple JDBC results
body: <p>So I'm trying to print out all of the hospitals in my program that deal with certain severity levels of medical conditions (High, medium and low), which are passed from another part of my program.</p>
  
  <p>Initially, it'll find the correct severity level, and so it'll check against another table in the database to find hospitals and print them. However, it is only printing one of the hospitlals (there are two for high severity which Im testing with) but not the other one. </p>
  
  <p>Any help would be appreciated, I feel like my looping is wrong.</p>
  
  <p>Thanks.</p>
  
  <pre><code>// Create selection query, get relevant hospitals
  String select = "SELECT * FROM hospitals WHERE hospitalSeverityHandling = '" + medicalCondition + "'";
  
  
  // Get results hospitals in the database
  ResultSet results = statement.executeQuery(select);
  
  // When hospitals have been found 
  
  if (results.next())
  {
      results.first();
  
      // Get hospitals with relevant severity
      //String hospital = results.getString("hospitalName");
      //System.out.println(hospital);
  
      // Respond to user, get hospital selection
      // TODO Hospital Selection
      JOptionPane.showMessageDialog(null, "A list of hospitals have been retrieved for severity level: " + medicalCondition, "Select available hospital", JOptionPane.INFORMATION_MESSAGE);   
  
      // Loop hospitals
      while(results.next())
      {
          String hospital = results.getString("hospitalName");
          System.out.println(hospital);
      }
  }
  </code></pre>