dimanche 26 juillet 2015

insert java check box value into sql

does anyone know how to insert the check box value into sql? All the check boxes value will correspond in one column of the field(Preferences). Values will be inserted when the process button has clicked. The coding are as below:

public void addPlace( String t, String k, String z,String h) throws Exception{

    DatabaseConnection db=new DatabaseConnection();
    Connection connect=db.getConnection();

    String sql="Insert into menu(Type,Budget,Day,Preferences)VALUES (?,?,?,?)";

    PreparedStatement ps=connect.prepareStatement(sql);
    ps.setString(1,t);
    ps.setString(2,k);
    ps.setString(3,z);
    ps.setString(4,h);
    ps.executeUpdate();
    connect.close();
    ps.close();
}

Everything working fine actually just I need some guidance on how to store multiple check box values in a single column in a MySQL DB. I really need help seriously . Your help would be greatly appreciated :)




Aucun commentaire:

Enregistrer un commentaire