I'm on a course, trying to get a scorm (It's a geogebra exercice)
Error: mdb->get_record() found more than one record!
- line 1563 of /lib/dml/moodle_database.php: call to debugging()
- line 1523 of /lib/dml/moodle_database.php: call to moodle_database->get_record_sql()
- line 1502 of /lib/dml/moodle_database.php: call to moodle_database->get_record_select()
- line 1896 of /mod/scorm/locallib.php: call to moodle_database->get_record()
- line 932 of /mod/scorm/locallib.php: call to scorm_get_toc()
- line 176 of /mod/scorm/view.php: call to scorm_print_launch()
So here is the line that trigger the error :
When I looked at the database (table scorm_scoes) to see what was the problem, I saw that concat(scorm, '-', identifier) do have double, wich makes sense since that's the error I was getting yay
Here is the (simple) query I used to see what were the lines affected (you may want to add a limit):
For each scorms that have the problem, there is two lines in mdl_scorm_scoes :
- first :
- parent = '/'
- identifier = 'main'
- launch = ''
- scormtype = ''
- title = 'GeoGebra Applet'
- second :
- parent = 'main'
- identifier = 'MAIN'
- launch = '<some-address>'
- scormtype = 'sco'
- title = '<some-title>'
Since MySQL is not case sensitive, the 'main' and 'MAIN' identifier are considered as the same and we have multiple rows that correspond to the search.
I replaced the get_record with a get_record_sql doing a supplementary check on the 'launch' :
I don't know if testing the emptyness of 'launch' is really a good idea, it may create other bugs, but right now it fixed the problem for me.
I hope I gave enough clues