Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-28539

PHP Notice: Error: mdb->get_record() found more than one record!

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Minor Minor
    • None
    • 2.0.3
    • Backup, Questions
    • Moodle 2.0.3
    • Oracle
    • MOODLE_20_STABLE

      I am trying to backup and restore a quiz from one course to another one. I ran into this error:

      [Fri Jul 29 16:20:33 2011] [error] [client 128.1**.103.2] PHP Notice: Error: mdb->get_record() found more than one record!<ul style="text-align: left">
      <li>line 1277 of /lib/dml/moodle_database.php: call to debugging()</li>
      <li>line 1006 of /lib/dml/oci_native_moodle_database.php: call to moodle_database->get_record_sql()</li>
      <li>line 1340 of /lib/dml/moodle_database.php: call to oci_native_moodle_database->get_record_sql()</li>
      <li>line 134 of /backup/moodle2/restore_qtype_plugin.class.php: call to moodle_database->get_field_sql()</li>
      <li>line 131 of /backup/util/plan/restore_structure_step.class.php: call to restore_qtype_plugin->process_question_answer()</li>
      <li>line 103 of /backup/util/helper/restore_structure_parser_processor.class.php: call to restore_structure_step->process()</li><
      li>line 106 of /backup/util/xml/parser/processors/grouped_parser_processor.class.php: call to restore_structure_parser_processor->dispatch_chunk()</li>
      <li>line 91 of /backup/util/helper/restore_structure_parser_processor.class.php: call to grouped_parser_processor->postprocess_chunk()</li>
      <li>line in /var/www/html/moodle/lib/weblib.php on line 2899, referer: https://moodle.umass.edu/backup/restore.php

      Then I checked the source code, I found this on /backup/moodle2/restore_qtype_plugin.class.php

      ...
          127         } else {
          128             // Look in question_answers by answertext matching
          129             $sql = 'SELECT id
          130                       FROM {question_answers}
          131                      WHERE question = ?
          132                        AND ' . $DB->sql_compare_text('answer', 255) . ' = ' . $DB->sql_compare_text('?', 255);
          133             $params = array($newquestionid, $data->answertext);
          134             $newitemid = $DB->get_field_sql($sql, $params);
      ....

      I mean it totally makes sense for one question to have 2 same answers.
      For example, short answer:
      Aaron Smith comes from [New York], and Aria Smith comes from [New York].

      Why does it give me "found more than one record" error message? I did not check the whole program logic, but here why it checks only one answer for one question? For the multiple choice question, it is also possible to have the same answers.

      See the Attachment.

            stronk7 Eloy Lafuente (stronk7)
            longfeiyu Longfei Yu
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.