Hye,i have problem with looping....
this is my coding for now.
try{
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://localhost/finalproject", "root", "Amillia89");
Statement stmt=con.createStatement();
// String pick = "select * from synonym where words like= "+st+"% ";
ResultSet rs=stmt.executeQuery("select * from synonym where words like \""+st+"%\"");
String words="";
if(rs.next()){
words=rs.getString("words");
ResultSetMetaData rsmd = rs.getMetaData();
int col = rsmd.getColumnCount();
int count=0;
while(rs.next()) {
for (int i=1;i<col;i++){
count++;
}
String [] test = new String[count];
for(int a =1 ; a<count; a++)
{
for (int i=1;i<col;i++)
test[a] = rs.getString(i);
}
for(int a =1 ; a<count; a++)
{
System.out.println(test[a]);
}
}
}
}
catch(Exception ie)
{
ie.printStackTrace();
}
}
});
but the problem is, when i run this program,it keeps add the number of words.
for example, i choose alphabet using Jcombobox but the result is...
A BB CCC DDDD EEEEE FFFFFF GGGGGGG HHHHHHHH......... instead of ABCDEFGH........