java.sql.SQLException: Before start of result set Java
<p>I'm getting <code>java.sql.SQLException: Before start of result set</code> when I try to use this code:</p>

<pre><code>ResultSet user = query("SELECT `id`, `counter` FROM `accounts` WHERE `username`='test'");
int id = user.getInt("id");
int counter = user.getInt("counter");
System.out.println("Id: " + id + " | Counter: " + counter);
</code></pre>

<p>All I really need to do is get the values of id and counter and set it to an integer in java but I'm not sure how to do that this is the third method I've tried, is there anything else I can do to get that information? I know for a fact the problem isn't with my query method so I figured it'll be pointless to show it, this is pretty much the entire snippet. (Yes the connection is opened and closed no problem) Any help would be appreciated.</p>