I'm using dynamic checkbox to retrive some values. It works fine but when i save to database it saves each record individually. I want to join all the records into one and save it as a single entry in the database. This is my code
rst2 = stm1.executeQuery("select * from students");
String Childic = "";
for(int i = 0; rst2.next(); i++){
if(request.getParameter("ca1_"+i) !=null){
Childic = rst2.getString("Childic") ;
String query2 = "INSERT into results(ca1) values ('"+Childic+"')";
stm2.executeUpdate(query2);
}
else{
}
}
Right now it saves as
A - 1st record
B - 2nd record
C - 3nd record
I want it to be
A B C - 1st record
Thank you for your help.