Ok im trying to get a integer from a row in the database here is how im doing it Code: rs = st.executeQuery("SELECT temptime FROM bans WHERE username = '"+p.getName()+"' ORDER BY id LIMIT 0, 1"); int tempend = Integer.parseInt(rs.getString(1)); but it returns an error saying 19:04:17 [INFO] Before start of result set Help? EDIT by Moderator: merged posts, please use the edit button instead of double posting.
we have to see the full code and the database to help you right. The error occurs, because the pointer is at the wrong position (before the first element)
Code:java ResultSet rs = null;int result = 0;rs = st.executeQuery("SELECT temptime FROM bans WHERE username = '"+p.getName()+"' ORDER BY id LIMIT 0, 1");try { if (rs != null && rs.next()) { result = rs.getInt("name"); }} catch (SQLException e) { e.printStackTrace();}