i want to get all the records that has a particular user name from my database and store each into a parallel array. The problem i am having is that its only getting the last record. How can i get the all record ere is an example of the code.
String [] day = new String [5]; String [] time = new String [5]; String [] course = new String [5]; try { Connection connect = DriverManager.getConnection("jdbc:mysql://localhost/somedatase","some name",""); Statement state = connect.createStatement (); ResultSet rs = state.executeQuery("Select * FROM time_table WHERE user_name='" + user +"'"); int x = 0; while (rs.next ()) { day[x] = rs.getString("day"); time[x] = rs.getString ("time"); course[x] = rs.getString ("course"); } connect.close (); state.close (); rs.close (); }//end try catch (SQLException e) { e.printStackTrace (); }//end catch