foreach ($quiz_array as $this_quiz_array) { $all_quizzes->addQuiz(new Quiz($this_quiz_array)); } /*** Load questions from old database and store in new database ***/ // Connect to the old database $olddb = new Database($old_db_entries); if ($db->getStatus() != 1) { die("Unable to connect to database " . $old_db_entries['hostname'] . " " . $old_db_entries['database']); } // create sql to load questions $old_sql = "SELECT * from " . $old_entries['$dbtable']; // Loads all questions - note that this requires a significant // amount of available memory - depending upon the number of questions and php settings // If this fails due to insufficient memory then check memory_limit in php.ini // Questions take up very little memory in the database so it would need to be a very large number of questions to be of concern $old_questions_array = $olddb->getRowsAll($old_sql); foreach ($old_questions_array as $this_question) { // create new question $this_questionid = $qdb->addQuestion($this_question); if ($debug) { print "Quizzes are " . $this_question['quiz'] . "<br />\n\n"; } $this_question_quizzes = explode(',', $this_question['quiz']); if (!empty($this_question_quizzes)) { foreach ($this_question_quizzes as $this_quiz) { if ($debug) { print "Adding {$this_quiz}<br />\n"; } $qdb->addQuestionQuiz($this_quiz, $this_questionid); } }