Code example for ResultSet

Methods: firstgetInt

0
		try { 
			query = connection.prepareStatement(Database.SELECT_USER_ID);
			query.setString(1, username);
			query.setString(2, password);
			result = query.executeQuery();
			if (result.first()) {
				id = result.getInt("id");
			} 
		} catch (Exception e) {
			 
		} 
		return id;
	} 
	 
	public static JSONObject getUserInfo(int id) {
		if (connection == null) Database.startConnection();
		PreparedStatement query = null;
		ResultSet result = null;
		JSONObject info = null;
		try { 
Stop searching for code, let great code find you!  Add Codota to your java IDE