public static Challenge[] getChallenges(Connection con, int user_id)
			throws SQLException {
		ResultSet rs = con.createStatement().executeQuery("SELECT c.*, u.username, q.title FROM challenges AS c INNER JOIN users AS u ON c.challenged_by = u.id INNER JOIN quizzes AS q ON c.quiz_id = q.id WHERE c.challenged_user = "
				+ user_id
				+ " ORDER BY c.challenged_on DESC");
		rs.last();
		int size = rs.getRow();
		Challenge[] challenges = new Challenge[size];
		rs.first();
		for (int i = 0; i < size; i++) {
			Challenge c = new Challenge(con, rs.getInt("id"), rs.getInt("quiz_id"), rs.getInt("challenged_by"), rs.getString("title"), rs.getString("username"), rs.getTimestamp("challenged_on"));
			challenges[i] = c;
			rs.next();
		}
		return challenges;
	}