Why can't I retrieve two values from different fields but same row?
If I write this, it works perfectly.
String sql = "SELECT * FROM soal ORDER BY RAND() LIMIT 1";
ResultSet rs = st.executeQuery(sql);
String question = rs.getString("questions");
But after I add this
String hint = rs.getString("hint_questions");
It won't work.
NOTE: I need two Strings,
hint from the same row and class for different purpose. So I have to use single
select query SQL so that value from
hint is related (from the same row).
You can try Either of the solution:
String var = rs.getString(1); through index
String var = rs.getString("column_name"); through column name