public static Quiz[] getQuizzesbyUser(int UserId, boolean Completed)
            {
                try {
        String query = String.format("SELECT * FROM QUIZ\n" +
            "where quizid %s in (select quizid from quizresult where \n" +
             "userid = %d)", Completed? " " : "not", UserId);
        ResultSet rs = getQueryResults(query);
        List<Quiz> quizzes = new ArrayList<Quiz>();
        while (rs.next())
        {
            Quiz q = new Quiz(rs.getString("QUIZTITLE"), rs.getInt("QUIZID"));
            q.timeLimit = rs.getInt("TimeAllowed");
            q.available = rs.getBoolean("Available");
            q.feedbackAvailable = rs.getBoolean("FeedbackAvailable");
            q.timeOutBehaviour = rs.getInt("TimeOutBehaviour");
            q.showPracticeQuestion = rs.getBoolean("ShowPracticeQuestion");
            q.navigationEnabled = rs.getBoolean("NAVIGATIONENABLED");
            q.randomiseQuestions = rs.getBoolean("RANDOMISEQUESTIONS");
            quizzes.add(q);
        }
        return quizzes.toArray(new Quiz[quizzes.size()]);
        }
        catch(SQLException se)
                {
                    return null;
                }
            }